def get_routing(user, routing_strategy):
    """
    Get routing key needed by event or listener.

    :param user: User to be routed.
    :type user: User

    :param routing_strategy: How it can compute routing key.
    :type routing_strategy: :class:`str`

    :return: Routing key for RabbitMQ.
    :rtype: :class:`str`
    """

    routing = routing_strategy.split('.')
    source = user
    if routing[0] == 'user':
        routing = routing[1:]
    for route in routing:
        source = getattr(source, route)
    return str(source)