code: def merge_feature_class(merges, out_fc, cleanUp=True):
      
      if arcpyFound == False:
          raise Exception("ArcPy is required to use this function")
      if cleanUp == False:
          if len(merges) == 0:
              return None
          elif len(merges) == 1:
              desc = arcpy.Describe(merges[0])
              if hasattr(desc, 'shapeFieldName'):
                  return arcpy.CopyFeatures_management(merges[0], out_fc)[0]
              else:
                  return arcpy.CopyRows_management(merges[0], out_fc)[0]
          else:
              return arcpy.Merge_management(inputs=merges,
                                            output=out_fc)[0]
      else:
          if len(merges) == 0:
              return None
          elif len(merges) == 1:
              desc = arcpy.Describe(merges[0])
              if hasattr(desc, 'shapeFieldName'):
                  merged = arcpy.CopyFeatures_management(merges[0], out_fc)[0]
              else:
                  merged = arcpy.CopyRows_management(merges[0], out_fc)[0]
          else:
              merged = arcpy.Merge_management(inputs=merges,
                                          output=out_fc)[0]
          for m in merges:
              arcpy.Delete_management(m)
              del m
          return merged
docs: merges featureclass into a single feature class