import csv
import json


def file_to_dict_list(filepath):
    """Accept a path to a CSV, TSV or JSON file and return a dictionary list"""
    if '.tsv' in filepath:
        reader = csv.DictReader(open(filepath), dialect='excel-tab')
    elif '.csv' in filepath:
        reader = csv.DictReader(open(filepath))
    elif '.json' in filepath:
        reader = json.load(open(filepath))
    else:
        raise ValueError('Unrecognized input file type')
    return list(reader)