def attr(obj, key):
    """
    A simple method to get the attribute of an object or a dictionary. This avoids complex statements like:

    `obj.something.another_thing["something"].another_thing["more"]`

    to just

    `attr(obj, "something.another_thing.something.another_thing.more")`

    :param obj: The object or dictionary to get an attribute from
    :param key: The attribute key such as "something.something"
    :return: The attribute
    """
    if isinstance(key, list):
        split = key
    else:
        split = key.split(".")
    key = split[0]
    if len(split) > 1:
        return attr(attr(obj, key), split[1:])
    if isinstance(obj, dict):
        return obj[key]
    return getattr(obj, key)