code: def generateCatalog(wcs, mode='automatic', catalog=None,
                      src_find_filters=None, **kwargs):
      
      if not isinstance(catalog,Catalog):
          if mode == 'automatic': # if an array is provided as the source
              # Create a new catalog directly from the image
              catalog = ImageCatalog(wcs,catalog,src_find_filters,**kwargs)
          else: # a catalog file was provided as the catalog source
              catalog = UserCatalog(wcs,catalog,**kwargs)
  
      return catalog
docs: Function which determines what type of catalog object needs to be
      instantiated based on what type of source selection algorithm the user
      specified.
  
      Parameters
      ----------
      wcs : obj
          WCS object generated by STWCS or PyWCS
  
      catalog : str or ndarray
          Filename of existing catalog or ndarray of image for generation of
          source catalog.
  
      kwargs : dict
          Parameters needed to interpret source catalog from input catalog
          with `findmode` being required.
  
      Returns
      -------
      catalog : obj
          A Catalog-based class instance for keeping track of WCS and
          associated source catalog