code: def get_varname_from_locals(val, locals_, default='varname-not-found',
                              strict=False, cmpfunc_=operator.is_):
      
      if val is None or isinstance(val, (int, float, bool)):
          # Cannot work on primative types
          return default
      try:
          for count, val_ in enumerate(six.itervalues(locals_)):
              if cmpfunc_(val, val_):
                  index_ = count
          varname = six.text_type(list(locals_.keys())[index_])
      except NameError:
          varname = default
          if strict:
              raise
      return varname
docs: Finds the string name which has where locals_[name] is val
  
      Check the varname is in the parent namespace
      This will only work with objects not primatives
  
      Args:
          val (): some value
          locals_ (dict): local dictionary to search
          default (str):
          strict (bool):
  
      Returns:
          str: the varname which is Val (if it exists)