Looks at a file's extension and format (if any) and returns format.

def resolve_format(format, path):
    """Looks at a file's extension and format (if any) and returns format.
    """
    if format is None:
        if (re.match(r'.+\.(yml|yaml)$', path)):
            return 'yaml'
        elif (re.match(r'.+\.tsv$', path)):
            return 'tsv'
    else:
        return format.lower()