<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def count_by(records: Sequence[Dict], field_name: str) -> defaultdict: """ Frequency each value occurs in a record sequence for a given field name. """


    counter = defaultdict(int)

    for record in records:
        name = record[field_name]
        counter[name] += 1

    return counter