code: def trimExtend(self,
                     sr,
                     polylines,
                     trimExtendTo,
                     extendHow=0):
          
          allowedHow = [0,1,2,4,8,16]
          if extendHow not in allowedHow:
              raise AttributeError("Invalid extend How value.")
          url = self._url + "/trimExtend"
          params = {
              "f" : "json",
              "sr" : sr,
              "polylines" : self.__geomToStringArray(geometries=polylines, returnType="list"),
              "extendHow": extendHow,
              "trimExtendTo" : trimExtendTo.asDictionary
  
          }
          return self._get(url=url, param_dict=params,
                              proxy_url=self._proxy_url,
                              securityHandler=self._securityHandler,
                              proxy_port=self._proxy_port)
docs: The trimExtend operation is performed on a geometry service resource. This 
          operation trims or extends each polyline specified in the input array, using 
          the user-specified guide polylines. When trimming features, the part to the 
          left of the oriented cutting line is preserved in the output, and the other 
          part is discarded. An empty polyline is added to the output array if the 
          corresponding input polyline is neither cut nor extended.
          
          Inputs:
              polylines - array of polylines to be trimmed or extended (structured as 
                          JSON polyline objects returned by the ArcGIS REST API).
              trimExtendTo - a polyline that is used as a guide for trimming or 
                             extending input polylines (structured as JSON polyline 
                             objects returned by the ArcGIS REST API).
              sr - spatial reference of the input polylines.
              extendHow - a flag that is used along with the trimExtend operation.