code: def to_dict(self, remove_nones=False):
          
          content = {}
          # Get the value of each attribute listed in _translation, and add it
          # to the content dict
          for key in self._translation:
              if hasattr(self, key):
                  content[key] = getattr(self, key)
          # also add parent_id, item_id, restricted, title and resources because
          # they are not listed in _translation
          content['parent_id'] = self.parent_id
          content['item_id'] = self.item_id
          content['restricted'] = self.restricted
          content['title'] = self.title
          if self.resources != []:
              content['resources'] = [resource.to_dict(remove_nones=remove_nones)
                                      for resource in self.resources]
          content['desc'] = self.desc
          return content
docs: Return the dict representation of the instance.
  
         Args:
              remove_nones (bool, optional): Optionally remove dictionary
                  elements when their value is `None`.
  
          Returns:
              dict: a dict representation of the `DidlObject`.