def resolve_dotted_attribute(obj, attr, allow_dotted_names=True):
 if allow_dotted_names:
  attrs = attr.split('.')
 else:
  attrs = [attr]
 for i in attrs:
  if i.startswith('_'):
   raise AttributeError(('attempt to access private attribute "%s"' % i))
  else:
   obj = getattr(obj, i)
 return obj

def resolve_dotted_attribute ( obj , attr , allow_dotted_names = True ) : if allow_dotted_names : attrs = attr . split ( '.' ) else : attrs = [ attr ] for i in attrs : if i . startswith ( '_' ) : raise AttributeError ( ( 'attempt to access private attribute "%s"' % i ) ) else : obj = getattr ( obj , i ) return obj
resolve_dotted_attribute => a .