def ref_to_obj(ref):
 if (not isinstance(ref, six.string_types)):
  raise TypeError('References must be strings')
 if (':' not in ref):
  raise ValueError('Invalid reference')
 (modulename, rest) = ref.split(':', 1)
 try:
  obj = __import__(modulename)
 except ImportError:
  raise LookupError(('Error resolving reference %s: could not import module' % ref))
 try:
  for name in (modulename.split('.')[1:] + rest.split('.')):
   obj = getattr(obj, name)
  return obj
 except Exception:
  raise LookupError(('Error resolving reference %s: error looking up object' % ref))

def ref_to_obj ( ref ) : if ( not isinstance ( ref , six . string_types ) ) : raise TypeError ( 'References must be strings' ) if ( ':' not in ref ) : raise ValueError ( 'Invalid reference' ) ( modulename , rest ) = ref . split ( ':' , 1 ) try : obj = __import__ ( modulename ) except ImportError : raise LookupError ( ( 'Error resolving reference %s: could not import module' % ref ) ) try : for name in ( modulename . split ( '.' ) [ 1 : ] + rest . split ( '.' ) ) : obj = getattr ( obj , name ) return obj except Exception : raise LookupError ( ( 'Error resolving reference %s: error looking up object' % ref ) )
returns the object pointed to by ref .