code: def add_source_get_correlated(gta, name, src_dict, correl_thresh=0.25, non_null_src=False):
      
      if gta.roi.has_source(name):
          gta.zero_source(name)
          gta.update_source(name)
          test_src_name = "%s_test" % name
      else:
          test_src_name = name    
  
      gta.add_source(test_src_name, src_dict)
      gta.free_norm(test_src_name)
      gta.free_shape(test_src_name, free=False)
      fit_result = gta.fit(covar=True)
  
      mask = fit_result['is_norm']
      src_names = np.array(fit_result['src_names'])[mask]
      idx = (src_names == test_src_name).argmax()
      correl_vals = fit_result['correlation'][idx][mask]
  
      cdict = {}
      for src_name, correl_val in zip(src_names, correl_vals):
          if src_name == name:
              continue
          if np.fabs(correl_val) > 0.25:
              cdict[src_name] = correl_val
  
      if not non_null_src:
          gta.zero_source(test_src_name)
  
      gta.fit(covar=True)
  
      return cdict, test_src_name
docs: Add a source and get the set of correlated sources
  
      Parameters
      ----------
  
      gta : `fermipy.gtaanalysis.GTAnalysis`
          The analysis object
  
      name : str
          Name of the source we are adding
  
      src_dict : dict
          Dictionary of the source parameters
  
      correl_thresh : float
          Threshold for considering a source to be correlated
  
      non_null_src : bool
          If True, don't zero the source
  
      Returns
      -------
  
      cdict : dict
          Dictionary with names and correlation factors of correlated sources 
  
      test_src_name : bool
          Name of the test source