def split_record(line, separator=';'):

    """Split `line` to a list of fields and a comment

    >>> split_record('0000..0009 ; XXX # some value')
    (['0000..0009', 'XXX'], 'some value')

    """

    try:
        i = line.index('#')
    except ValueError:
        record_line = line
        comment = ''
    else:
        record_line = line[:i]
        comment = line[i+1:]

    fields = [x.strip() for x in record_line.split(separator)]
    comment = comment.strip()

    return fields, comment