def import_from_name(name):
    """Import module from string.

    # Argument
        name: `str`. Such as `foo`, `foo.someclass` or `foo.somefunction`.

    # Return
        `module`: It could be module-typed, class-typed or function-typed.
    """
    names = name.split('.')
    mod = __import__(names[0])
    for i in range(1, len(names)):
        mod = getattr(mod, names[i])
    return mod