def match_file_to_dict(file_handler, key_dict, sep='\t', join_by=0):
    """
    Generator function for mapping a particular field in a file, separated by 'sep', to dictionary keys
    :param file_handler: Opened file object
    :param key_dict: Dictionary to map the selected field to
    :param sep: Field separator
    :param join_by: The field number to search the dictionary for
    :return: Line that matches a key
    """
    for line in file_handler:
        if line.split(sep)[join_by] in key_dict:
            yield line
