docs: def AddFeaturesToFeatureLayer(self, url, pathToFeatureClass, chunksize=0, lowerCaseFieldNames=False):
          """Appends local features to a hosted feature service layer.
  
          Args:
              url (str): The URL of the feature service layer.
              pathToFeatureClass (str): The path of the feature class on disk.
              chunksize (int): The maximum amount of features to upload at a time. Defaults to 0.
              lowerCaseFieldNames (bool): A boolean value indicating if field names should be converted
                  to lowercase before uploading. Defaults to ``False``.
          Returns:
              The result from :py:func:`arcrest.agol.services.FeatureLayer.addFeatures`.
          Raises:
              ArcRestHelperError: if ``arcpy`` can't be found.
          Notes:
              If publishing to a PostgreSQL database, it is suggested to to set ``lowerCaseFieldNames`` to ``True``.
  
          """
          if arcpyFound == False:
              raise common.ArcRestHelperError({
                  "function": "AddFeaturesToFeatureLayer",
                  "line": inspect.currentframe().f_back.f_lineno,
                  "filename":  'featureservicetools',
                  "synerror": "ArcPy required for this function"
              })
          fl = None
          try:
              fl = FeatureLayer(
                     url=url,
                     securityHandler=self._securityHandler)
  
              if chunksize > 0:
                  fc = os.path.basename(pathToFeatureClass)
                  inDesc = arcpy.Describe(pathToFeatureClass)
                  oidName = inDesc.oidFieldName
  
                  arr = arcpy.da.FeatureClassToNumPyArray(pathToFeatureClass, (oidName))
                  syncSoFar = 0
                  messages = {'addResults':[],'errors':[]}
                  total = len(arr)
                  errorCount = 0
                  if total == '0':
                      print ("0 features in %s" % pathToFeatureClass)
                      return "0 features in %s" % pathToFeatureClass
                  print ("%s features in layer" % (total))
  
                  arcpy.env.overwriteOutput = True
                  if int(total) < int(chunksize):
                      return fl.addFeatures(fc=pathToFeatureClass,lowerCaseFieldNames=lowerCaseFieldNames)
                  else:
                      newArr = chunklist(arr,chunksize)
                      exprList = ["{0} >= {1} AND {0} <= {2}".format(oidName, nArr[0][0], nArr[len(nArr)-1][0])
                          for nArr in newArr]
                      for expr in exprList:
  
                          UploadLayer = arcpy.MakeFeatureLayer_management(pathToFeatureClass, 'TEMPCOPY', expr).getOutput(0)
                          #print(arcpy.GetCount_management(in_rows=UploadLayer).getOutput(0) + " features in the chunk")
                          results = fl.addFeatures(fc=UploadLayer,lowerCaseFieldNames=lowerCaseFieldNames)
                          chunkCount = arcpy.GetCount_management(in_rows=UploadLayer).getOutput(0)
                          print(chunkCount + " features in the chunk")
                          if chunkCount > 0:
  
                              if results is not None and 'addResults' in results and results['addResults'] is not None:
                                  featSucces = 0
                                  for result in results['addResults']:
                                      if 'success' in result:
                                          if result['success'] == False:
                                              if 'error' in result:
                                                  errorCount  = errorCount + 1
                                                  print ("\tError info: %s" % (result))
                                          else:
                                              featSucces = featSucces + 1
                                  syncSoFar = syncSoFar + featSucces
                                  print ("%s features added in this chunk" % (featSucces))
                                  print ("%s/%s features added, %s errors" % (syncSoFar,total,errorCount ))
                                  if 'addResults' in messages:
                                      messages['addResults'] = messages['addResults'] + results['addResults']
                                  else:
                                      messages['addResults'] = results['addResults']
                              else:
                                  messages['errors'] = result
                  return messages
              else:
                  return fl.addFeatures(fc=pathToFeatureClass,lowerCaseFieldNames=lowerCaseFieldNames)
          except arcpy.ExecuteError:
              line, filename, synerror = trace()
              raise common.ArcRestHelperError({
                  "function": "AddFeaturesToFeatureLayer",
                  "line": line,
                  "filename":  filename,
                  "synerror": synerror,
                  "arcpyError": arcpy.GetMessages(2),
              }
                             )
          except:
              line, filename, synerror = trace()
              raise common.ArcRestHelperError({
                          "function": "AddFeaturesToFeatureLayer",
                          "line": line,
                          "filename":  filename,
                          "synerror": synerror,
                                          }
                                          )
          finally:
              fl = None
              del fl
              gc.collect()