code: def to_dict(self, properties=None):
          
          if not properties:
              skip = {'aids', 'sids', 'synonyms'}
              properties = [p for p in dir(Compound) if isinstance(getattr(Compound, p), property) and p not in skip]
          return {p: [i.to_dict() for i in getattr(self, p)] if p in {'atoms', 'bonds'} else getattr(self, p) for p in properties}
docs: Return a dictionary containing Compound data. Optionally specify a list of the desired properties.
  
          synonyms, aids and sids are not included unless explicitly specified using the properties parameter. This is
          because they each require an extra request.