code: def lookup_object(spec):
      
      parts, target = spec.split(':') if ':' in spec else (spec, None)
      module = __import__(parts)
  
      for part in parts.split('.')[1:] + ([target] if target else []):
          module = getattr(module, part)
  
      return module
docs: Looks up a module or object from a some.module:func_name specification.
      To just look up a module, omit the colon and everything after it.