def safename(name, mrbayes=False):
 if mrbayes:
  safe = name.replace(' ', '_')
  safe = ''.join((c for c in safe if (c in MRBAYESSAFE)))
 else:
  safe = name.replace("'", "''")
  if set(safe).intersection(set((WHITESPACE + PUNCTUATION))):
   safe = (("'" + safe) + "'")
 return safe

def safename ( name , mrbayes = False ) : if mrbayes : safe = name . replace ( ' ' , '_' ) safe = '' . join ( ( c for c in safe if ( c in MRBAYESSAFE ) ) ) else : safe = name . replace ( "'" , "''" ) if set ( safe ) . intersection ( set ( ( WHITESPACE + PUNCTUATION ) ) ) : safe = ( ( "'" + safe ) + "'" ) return safe
return a filename suitable for the cache .