def userinfo_from_token(context, tok):
    """
    Given an API token, return the associated user's information.

    **Parameters:**

    * `context`: the context associated with this request
    * `tok`: an API token

    **Returns:** a dictionary containing the information associated with the
    user who holds the given API token; it will contain some subset of the keys
    `'username'`, `'name'`, and `'email'`.  Returns `None` if the given token
    is invalid.
    """
    return context['csm_cslog'].most_recent('_api_tokens', [], str(tok), None)
