React to given (AMQP) message. `message` is expected to be
    :py:func:`collections.namedtuple` structure from :mod:`.structures` filled
    with all necessary data.

    Args:
        message (object): One of the request objects defined in
                          :mod:`.structures`.
        send_back (fn reference): Reference to function for responding. This is
                  useful for progress monitoring for example. Function takes
                  one parameter, which may be response structure/namedtuple, or
                  string or whatever would be normally returned.

    Returns:
        object: Response class from :mod:`structures`.

    Raises:
        ValueError: if bad type of `message` structure is given.

def reactToAMQPMessage(message, send_back):
    """
    React to given (AMQP) message. `message` is expected to be
    :py:func:`collections.namedtuple` structure from :mod:`.structures` filled
    with all necessary data.

    Args:
        message (object): One of the request objects defined in
                          :mod:`.structures`.
        send_back (fn reference): Reference to function for responding. This is
                  useful for progress monitoring for example. Function takes
                  one parameter, which may be response structure/namedtuple, or
                  string or whatever would be normally returned.

    Returns:
        object: Response class from :mod:`structures`.

    Raises:
        ValueError: if bad type of `message` structure is given.
    """
    if _instanceof(message, structures.AddUser):
        api.add_user(
            username=message.username,
            password=message.password
        )
        return True
    elif _instanceof(message, structures.RemoveUser):
        api.remove_user(message.username)
        return True
    elif _instanceof(message, structures.ChangePassword):
        api.change_password(
            username=message.username,
            new_password=message.new_password
        )
        return True
    elif _instanceof(message, structures.ListRegisteredUsers):
        return structures.Userlist(api.list_users())
    elif _instanceof(message, structures.SetUserSettings):
        username = message.username

        # convert namedtuple to dict (python rocks)
        conf_dict = dict(message._asdict())
        del conf_dict["username"]

        passwd_reader.save_user_config(
            username,
            conf_dict
        )

        conf_dict = passwd_reader.read_user_config(username)
        conf_dict["username"] = username
        return structures.UserSettings(**conf_dict)
    elif _instanceof(message, structures.GetUserSettings):
        conf_dict = passwd_reader.read_user_config(message.username)
        conf_dict["username"] = message.username
        return structures.UserSettings(**conf_dict)

    raise ValueError(
        "Unknown type of request: '" + str(type(message)) + "'!"
    )