def legitimize(text, os=platform.system()):
 text = text.translate({0: None, ord('/'): '-', ord('|'): '-'})
 if (os == 'Windows'):
  text = text.translate({ord(':'): '-', ord('*'): '-', ord('?'): '-', ord('\\'): '-', ord('"'): "'", ord('+'): '-', ord('<'): '-', ord('>'): '-', ord('['): '(', ord(']'): ')'})
 else:
  if (os == 'Darwin'):
   text = text.translate({ord(':'): '-'})
  if text.startswith('.'):
   text = text[1:]
 text = text[:82]
 return text

def legitimize ( text , os = platform . system ( ) ) : text = text . translate ( { 0 : None , ord ( '/' ) : '-' , ord ( '|' ) : '-' } ) if ( os == 'Windows' ) : text = text . translate ( { ord ( ':' ) : '-' , ord ( '*' ) : '-' , ord ( '?' ) : '-' , ord ( '\\' ) : '-' , ord ( '"' ) : "'" , ord ( '+' ) : '-' , ord ( '<' ) : '-' , ord ( '>' ) : '-' , ord ( '[' ) : '(' , ord ( ']' ) : ')' } ) else : if ( os == 'Darwin' ) : text = text . translate ( { ord ( ':' ) : '-' } ) if text . startswith ( '.' ) : text = text [ 1 : ] text = text [ : 82 ] return text
converts a string to a valid filename .