code: def num_or_str(x):
      
      if isnumber(x): return x
      try:
          return int(x)
      except ValueError:
          try:
              return float(x)
          except ValueError:
              return str(x).strip()
docs: The argument is a string; convert to a number if possible, or strip it.
      >>> num_or_str('42')
      42
      >>> num_or_str(' 42x ')
      '42x'