code: def serialize_relations(pid):
      
      data = {}
      relations = PIDRelation.get_child_relations(pid).all()
      for relation in relations:
          rel_cfg = resolve_relation_type_config(relation.relation_type)
          dump_relation(rel_cfg.api(relation.parent),
                        rel_cfg, pid, data)
      parent_relations = PIDRelation.get_parent_relations(pid).all()
      rel_cfgs = set([resolve_relation_type_config(p) for p in parent_relations])
      for rel_cfg in rel_cfgs:
          dump_relation(rel_cfg.api(pid), rel_cfg, pid, data)
      return data
docs: Serialize the relations for given PID.