code: def is_installed(self, package):
          
          if isinstance(package, tuple):
              package = '=='.join(package)
          if package.endswith('.git'):
              pkg_name = os.path.split(package)[1][:-4]
              return pkg_name in self.installed_package_names or \
                      pkg_name.replace('_', '-') in self.installed_package_names
          pkg_tuple = split_package_name(package)
          if pkg_tuple[1] is not None:
              return pkg_tuple in self.installed_packages
          else:
              return pkg_tuple[0].lower() in self.installed_package_names
docs: Returns True if the given package (given in pip's package syntax or a
          tuple of ('name', 'ver')) is installed in the virtual environment.