def quote_escape(value, lf='&mjf-lf;', quot='&mjf-quot;'):
 if ('\n' in value):
  value = value.replace('\n', lf)
 if (("'" in value) and ('"' in value)):
  value = value.replace('"', quot)
 return value

def quote_escape ( value , lf = '&mjf-lf;' , quot = '&mjf-quot;' ) : if ( '\n' in value ) : value = value . replace ( '\n' , lf ) if ( ( "'" in value ) and ( '"' in value ) ) : value = value . replace ( '"' , quot ) return value
escape a string so that it can safely be quoted .