code: def asDictionary(self):
          
          template =  {
              "type": "dataLayer",
              "dataSource": self._dataSource
          }
          if not self._fields is None:
              template['fields'] = self._fields
          return template
docs: returns the value as a dictionary