from functools import reduce


def import_object_by_definition(definition):
    """Dynamic importing of an object by it's definition. E.g. 'a.b.c' returns c"""
    return reduce(
        getattr, definition.split(".")[1:], __import__(definition.partition(".")[0])
    )