def get_value_assigned_to_user(user_data, key):
    """
    Try to retrieve (attribute) value assigned to an user.

    In practise it will be certificate or key. KeyError will be raised in case
    of improper payload format or when the attribute for given key does not
    exist.
    """
    d = user_data["user"]
    return d[key]