def _padtrim(entry, n_bytes):
    """
    Pad or trim an EDF header field entry to n_bytes bytes.
    """
    entry = str(entry)
    n_bytes -= len(entry)
    if n_bytes >= 0:
        entry = entry + ' ' * n_bytes
    else:
        entry = entry[0:n_bytes]
    return entry.encode()
