code: def comparable(self):
          
          document_dict = self.compare_safe(self._document)
  
          # Remove uncompared fields
          self._remove_keys(document_dict, self._uncompared_fields)
  
          # Remove any empty values
          clean_document_dict = {}
          for k, v in document_dict.items():
              if not v and not isinstance(v, (int, float)):
                  continue
              clean_document_dict[k] = v
  
          # Convert any referenced fields to Frames
          for ref_field, ref_cls in self._compared_refs.items():
              ref = getattr(self, ref_field)
              if not ref:
                  continue
  
              # Check for fields which contain a list of references
              if isinstance(ref, list):
                  if isinstance(ref[0], Frame):
                      continue
  
                  # Dereference the list of reference IDs
                  setattr(
                      clean_document_dict,
                      ref_field,
                      ref_cls.many(In(Q._id, ref))
                      )
  
              else:
                  if isinstance(ref, Frame):
                      continue
  
                  # Dereference the reference ID
                  setattr(
                      clean_document_dict,
                      ref_field,
                      ref_cls.byId(ref)
                      )
  
          return clean_document_dict
docs: Return a dictionary that can be compared