code: def get_package_name(filepath):
      """
      Given a path where a package is installed, determine its name.
  
      Parameters
      ----------
      filepath : str
          Path to a file. If the determination fails, "numpy" is returned.
  
      Examples
      --------
      >>> np.testing.nosetester.get_package_name('nonsense')
      'numpy'
  
      """
  
      fullpath = filepath[:]
      pkg_name = []
      while "site-packages" in filepath or "dist-packages" in filepath:
          filepath, p2 = os.path.split(filepath)
          if p2 in ("site-packages", "dist-packages"):
              break
          pkg_name.append(p2)
  
      # if package name determination failed, just default to numpy/scipy
      if not pkg_name:
          if "scipy" in fullpath:
              return "scipy"
          else:
              return "numpy"
  
      # otherwise, reverse to get correct order and return
      pkg_name.reverse()
  
      # don't include the outer egg directory
      if pkg_name[0].endswith(".egg"):
          pkg_name.pop(0)
  
      return ".".join(pkg_name)
  
file_path: catboost/contrib/python/numpy/py2/numpy/testing/_private/nosetester.py
imports: from __future__ import division, absolute_import, print_function
  import os
  import sys
  import warnings
  from numpy.compat import basestring
  import numpy
  from .utils import import_nose, suppress_warnings
label_desc: Use image node_id 1 for calling a global function with example usage: get_package_name(filepath) and returns: str, str, str