code: def mem(data):
      
      
      if type(data) == dict:
          num = sum([data[k].memory_usage(index=True).sum() for k in data])
      else:
          num = data.memory_usage(index=True).sum()
      for x in ['bytes', 'KB', 'MB', 'GB', 'TB']:
          if num < 1024.0:
              return "%3.1f %s" % (num, x)
          num /= 1024.0
      return "%3.1f %s" % (num, 'PB')
docs: Total memory used by data
      
      Parameters
      ----------
      data : dict of pandas.DataFrames or pandas.DataFrame
      
      Returns
      -------
      str : str
          Human readable amount of memory used with unit (like KB, MB, GB etc.).