code: def serialize(obj):
          
          if isinstance(obj, str_types):
              return obj
          elif hasattr(obj, 'timetuple'):
              return int(time.mktime(obj.timetuple())) * 1000
          elif hasattr(obj, 'item'):
              return obj.item()
          elif hasattr(obj, '__float__'):
              if isinstance(obj, int):
                  return int(obj)
              else:
                  return float(obj)
          elif hasattr(obj, '__int__'):
              return int(obj)
          else:
              raise LoadError('cannot serialize index of type '
                              + type(obj).__name__)
docs: Convert an object into a JSON-serializable value
  
          This is used by the ``from_pandas`` and ``from_numpy`` functions to
          convert data to JSON-serializable types when loading.