def find_client_id(conn, name):
    """returns the SAMP id of the client with samp.name samp_name.

    This will raise a KeyError if the client is not on the hub.
    """
    for client_id in conn.get_registered_clients():
        if conn.get_metadata(client_id).get("samp.name") == name:
            return client_id
    raise KeyError(name)