for line in open('file', 'r'):
    fields = line.split('\t')
fieldMap = {}
for field in fields:
    key = field.split(' ', 1)[0]
fieldMap[key] = field
print('\t'.join([fieldMap.get(key, 'NA') for key in requiredKeys]))
Parsing a tab-separated file with missing fields 