code: def aliasSub(requestContext, seriesList, search, replace):
      
      try:
          seriesList.name = re.sub(search, replace, seriesList.name)
      except AttributeError:
          for series in seriesList:
              series.name = re.sub(search, replace, series.name)
      return seriesList
docs: Runs series names through a regex search/replace.
  
     Example::
  
          &target=aliasSub(ip.*TCP*,"^.*TCP(\d+)","\\1")