code: def _get_target(self, target):
          depth = target.count('.') + 1
          parts = target.split('.', 1)
          for m in self.modules:
              if parts[0] == m.name:
                  if depth < 3:
                      return m
          for p in self.packages:
              if parts[0] == p.name:
                  if depth == 1:
                      return p
                  target = p._get_target(parts[1])
                  if target:
                      return target
                  if depth < 3:
                      return p
          return None