human
Complete this python program:
def combine_repeated_headers(kvset):
assistant
#Here is the Python code you requested.

    """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.
    """
    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)]