def serial_escape(value):
 return value.replace('\\', '\\\\').replace(' ', '\\ ')

def serial_escape ( value ) : return value . replace ( '\\' , '\\\\' ) . replace ( ' ' , '\\ ' )
escape string values that are elements of a list .