def dict_of(st):
  """Converts struct objects into dictionaries."""
  data = dict()
  for key in dir(st):
    value = getattr(st, key, None)
    if value != None: # skip methods
      data[key] = value
  return data