def _clean_tags(tags):
 def clean(tagstr):
  if isinstance(tagstr, str):
   return tagstr.replace('|', '_')[:200]
  return unicode(tagstr).replace('|', '_')[:200].encode('utf-8')
 return [clean(t) for t in tags]

def _clean_tags ( tags ) : def clean ( tagstr ) : if isinstance ( tagstr , str ) : return tagstr . replace ( '|' , '_' ) [ : 200 ] return unicode ( tagstr ) . replace ( '|' , '_' ) [ : 200 ] . encode ( 'utf-8' ) return [ clean ( t ) for t in tags ]
helper method that does the actual cleaning of tags for sending to statsd .