def resolveDottedName(dotted_name):
    """Resolve the dotted name importing as necessary then using
    getattr."""
    idx = dotted_name.find('.')
    if idx == -1:
        base_name = dotted_name
        rest_path = []
    else:
        base_name = dotted_name[:idx]
        rest_path = dotted_name[idx + 1:].split('.')
    obj = __import__(base_name)
    for name in rest_path:
        obj = getattr(obj, name)
    return obj
