'package.module.attr style'

def _zope_dottedname_style(self, value, package):

    module = getattr(package, '__name__', None)
    if (not module):
        module = None
    if (value == '.'):
        if (module is None):
            raise ValueError(('relative    name    %r    irresolveable    without    package' % (value,)))
        name = module.split('.')
    else:
        name = value.split('.')
        if (not name[0]):
            if (module is None):
                raise ValueError(('relative    name    %r    irresolveable    without    package' % (value,)))
            module = module.split('.')
            name.pop(0)
            while (not name[0]):
                module.pop()
                name.pop(0)
            name = (module + name)
    used = name.pop(0)
    found = __import__(used)
    for n in name:
        used += ('.' + n)
        try:
            found = getattr(found, n)
        except AttributeError:
            __import__(used)
            found = getattr(found, n)
    return found
