def make_hash(keys, **kwargs):
    """
    Creates a perfect hash function from the given keys. For a
    description of the keyword arguments see :py:func:`hash_parameters`.

    >>> l = (0, 3, 4, 7 ,10, 13, 15, 18, 19, 21, 22, 24, 26, 29, 30, 34)
    >>> hf = make_hash(l)
    >>> hf(19)
    1
    >>> hash_parameters(l).slots[1]
    19
    """
    params = hash_parameters(keys, **kwargs)

    t = params.t
    r = params.r
    offset = params.offset
    to_int = params.to_int if params.to_int else __identity

    def perfect_hash(x):
        val = to_int(x) + offset
        x = val % t
        y = val // t
        return x + r[y]

    # Undocumented properties, but used in make_dict()...
    perfect_hash.length = len(params.slots)
    perfect_hash.slots = params.slots
    return perfect_hash