human
Complete the below
def combine_repeated_headers(kvset):

    ''''Given a list of key-value pairs (like for HTTP headers!), combines pairs
    with the same key together, separating the values with NULL bytes. This
    function maintains the order of input keys, because it\'s awesome.'
    '''

What is a the Python code you requested?
assistant
#Here is the Python code you requested.
    def set_pop(set, item):
        set.remove(item)
        return item
    headers = defaultdict(list)
    keys = set()
    for (key, value) in kvset:
        headers[key].append(value)
        keys.add(key)
    return [(set_pop(keys, k), '\x00'.join(headers[k])) for (k, v) in kvset if (k in keys)]