def get_from_module(attrname):
    """
    Returns the Python class/method of the specified |attrname|.
    Typical usage pattern:
        m = get_class("this.module.MyClass")
        my_class = m(**kwargs)
    """
    parts = attrname.split('.')
    module = '.'.join(parts[:-1])
    m = __import__(module)
    for comp in parts[1:]:
        m = getattr(m, comp)
    return m