def pop_pseudo_headers(entries):
    """Remove and return HTTP/2 `pseudo-headers`__ from a list of headers.

    __ https://tools.ietf.org/html/rfc7540#section-8.1.2.1

    :param entries:
        A list of header name-value pairs,
        as would be passed to :class:`httpolice.Request`
        or :class:`httpolice.Response`.
        It will be modified in-place by removing all names
        that start with a colon (:).
    :return: A dictionary of the removed pseudo-headers.
    """
    i = 0
    r = {}
    while i < len(entries):
        name, value = entries[i]
        if name.startswith(u':'):
            r[name] = value
            del entries[i]
        else:
            i += 1
    return r
