def make_hybi07_frame_dwim(buf):
 if isinstance(buf, str):
  return make_hybi07_frame(buf, opcode=2)
 elif isinstance(buf, unicode):
  return make_hybi07_frame(buf.encode('utf-8'), opcode=1)
 else:
  raise TypeError('In binary support mode, frame data must be either str or unicode')

def make_hybi07_frame_dwim ( buf ) : if isinstance ( buf , str ) : return make_hybi07_frame ( buf , opcode = 2 ) elif isinstance ( buf , unicode ) : return make_hybi07_frame ( buf . encode ( 'utf-8' ) , opcode = 1 ) else : raise TypeError ( 'In binary support mode, frame data must be either str or unicode' )
make a hybi-07 frame with binary or text data according to the type of buf .