def _encode_optimized(item):
 if isinstance(item, bytes):
  if ((len(item) == 1) and (ord(item) < 128)):
   return item
  prefix = length_prefix(len(item), 128)
 else:
  item = ''.join([_encode_optimized(x) for x in item])
  prefix = length_prefix(len(item), 192)
 return (prefix + item)

def _encode_optimized ( item ) : if isinstance ( item , bytes ) : if ( ( len ( item ) == 1 ) and ( ord ( item ) < 128 ) ) : return item prefix = length_prefix ( len ( item ) , 128 ) else : item = '' . join ( [ _encode_optimized ( x ) for x in item ] ) prefix = length_prefix ( len ( item ) , 192 ) return ( prefix + item )
rlp encode bytes .