code: def main(*argv):
      
      try:
          adminUsername = argv[0]
          adminPassword = argv[1]
          siteURL = argv[2]
          deleteUser = argv[3]
          #   Logic
          #
          sh = arcrest.AGOLTokenSecurityHandler(adminUsername, adminPassword)
          admin = arcrest.manageorg.Administration(securityHandler=sh)
          community = admin.community
          user = community.user
          res = user.deleteUser(username=deleteUser)
          if res.has_key('success'):
              arcpy.SetParameterAsText(4, str(res['success']).lower() == "true")
          else:
              arcpy.SetParameterAsText(4, False)
          del sh
          del admin
          del community
          del user
          del res
      except arcpy.ExecuteError:
          line, filename, synerror = trace()
          arcpy.AddError("error on line: %s" % line)
          arcpy.AddError("error in file name: %s" % filename)
          arcpy.AddError("with error message: %s" % synerror)
          arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2))
      except FunctionError, f_e:
          messages = f_e.args[0]
          arcpy.AddError("error in function: %s" % messages["function"])
          arcpy.AddError("error on line: %s" % messages["line"])
          arcpy.AddError("error in file name: %s" % messages["filename"])
          arcpy.AddError("with error message: %s" % messages["synerror"])
          arcpy.AddError("ArcPy Error Message: %s" % messages["arc"])
      except:
          line, filename, synerror = trace()
          arcpy.AddError("error on line: %s" % line)
          arcpy.AddError("error in file name: %s" % filename)
          arcpy.AddError("with error message: %s" % synerror)
docs: main driver of program