code: def _try_to_squeeze(obj, raise_=False):
      
  
      if isinstance(obj, pd.Series):
          return obj
      elif isinstance(obj, pd.DataFrame) and obj.shape[-1] == 1:
          return obj.squeeze()
      else:
          if raise_:
              raise ValueError("Input cannot be squeezed.")
          return obj
docs: Attempt to squeeze to 1d Series.
  
      Parameters
      ----------
      obj : {pd.Series, pd.DataFrame}
      raise_ : bool, default False