docs: def generate(self,
                   publishParameters,
                   itemId=None,
                   filePath=None,
                   fileType=None,
                   option='on'
                   ):
          """
          The Generate call helps a client generate features from a CSV file
          or a shapefile.
          CSV files that contain location fields (either address fields or X,
          Y fields) are spatially enabled by the Generate operation.
          The result of Generate is a JSON feature collection.
          If the file to be analyzed already exists in the portal as an item,
          callers can pass in its itemId. Callers can also directly post the
          file. In this case, the request must be a multipart post request
          pursuant to IETF RFC1867. The third option for text files is to
          pass the text in as the value of the text parameter.
          Generate requires that the caller pass in publish parameters that
          describe the layers in the feature collection to be generated.
  
          Inputs:
             publishParameters - A JSON object describing the layer and
                                 service to be created as part of the Publish
                                 operation. The appropriate value for publish
                                 parameters depends on the file type being
                                 published. (Python Dictionary)
             itemId - unique id of item to generate
             filePath - path to zipped shapefile or csv
             fileType - either shapefile or csv
          """
          allowedFileTypes = ['shapefile', 'csv']
          files = {}
          url = self._url + "/generate"
          params = {
              "f" : "json"
          }
          params['publishParameters'] = publishParameters
          params['option'] = option
  
  
          if fileType.lower() not in allowedFileTypes and \
             filePath is not None:
              raise AttributeError("fileType must be either shapefile or csv when specifying a file")
          if filePath is not None:
              params['filetype'] = fileType
              #Changed from type to filetype to generate a FC from zip
              if fileType.lower() == "csv":
                  params['text'] = open(filePath,'rb').read()
                  return self._post(url=url, param_dict=params,
                                       securityHandler=self._securityHandler,
                                       proxy_url=self._proxy_url,
                                       proxy_port=self._proxy_port)
              else:
                  files['file'] = filePath
                  res = self._post(url=url,
                                   param_dict=params,
                                   files=files,
                                   securityHandler=self._securityHandler,
                                   proxy_url=self._proxy_url,
                                   proxy_port=self._proxy_port)
                  return res
          elif itemId is not None:
              params["fileType"] = fileType
              params['itemId'] = itemId
              return self._post(url=url, param_dict=params,
                                   securityHandler=self._securityHandler,
                                   proxy_url=self._proxy_url,
                                   proxy_port=self._proxy_port)