code: def packageOf(self, dotted_name, packagelevel=None):
          
          if '.' not in dotted_name:
              return dotted_name
          if not self.isPackage(dotted_name):
              dotted_name = '.'.join(dotted_name.split('.')[:-1])
          if packagelevel:
              dotted_name = '.'.join(dotted_name.split('.')[:packagelevel])
          return dotted_name
docs: Determine the package that contains ``dotted_name``.