human
Here's a good function header given the following:
I wrote the below code

    buf = ''
    prev = content = fh.read()
    if (fields is None):
        timestamp_key = 'timestamp'
        message_key = 'message'
    else:
        try:
            timestamp_key = next(iter(filter((lambda field: (field['type'] in DATE_FIELD_TYPES)), fields)))['name']
        except:
            LOG.exception('failed    to    get    timestamp    key')
            timestamp_key = None
        try:
            message_key = next(iter(filter((lambda field: (field['type'] in TEXT_FIELD_TYPES)), fields)))['name']
        except:
            LOG.exception('failed    to    get    message    key')
            message_key = None
    def value_generator(buf):
        rows = buf.split('\n')
        for row in rows:
            if row:
                data = {}
                matches = re.search(TIMESTAMP_PATTERN, row)
                if (matches and timestamp_key):
                    data[timestamp_key] = parse(matches.groups()[0]).astimezone(pytz.utc).strftime('%Y-%m-%dT%H:%M:%SZ')
                if message_key:
                    data[message_key] = row
                (yield data)
    while prev:
        last_newline = content.rfind('\n')
        if (last_newline > (-1)):
            buf = content[:last_newline]
            content = content[(last_newline + 1):]
            for row in value_generator(buf):
                (yield row)
        prev = fh.read()
        content += prev
    if content:
        for row in value_generator(content):
            (yield row)

What's a good function header?
assistant
#Here's a good function header.

def field_values_from_log(fh, fields=[{'name': 'message', 'type': 'text_general'}, {'name': 'tdate', 'type': 'timestamp'}]):