def preffiletype(preffile):
    """ Infer type from first uncommented line in preffile
    """

    with open(preffile, 'r') as fp:
        while True:
            line = fp.readline().split('#')[0]
            if line:
                break

    if '=' in line:
        return 'old'
    elif ':' in line:
        return 'yaml'
    else:
        return None