def uu_encode(input, errors='strict', filename='<data>', mode=438):
 assert (errors == 'strict')
 from cStringIO import StringIO
 from binascii import b2a_uu
 infile = StringIO(str(input))
 outfile = StringIO()
 read = infile.read
 write = outfile.write
 write(('begin %o %s\n' % ((mode & 511), filename)))
 chunk = read(45)
 while chunk:
  write(b2a_uu(chunk))
  chunk = read(45)
 write(' \nend\n')
 return (outfile.getvalue(), len(input))

def uu_encode ( input , errors = 'strict' , filename = '<data>' , mode = 438 ) : assert ( errors == 'strict' ) from cStringIO import StringIO from binascii import b2a_uu infile = StringIO ( str ( input ) ) outfile = StringIO ( ) read = infile . read write = outfile . write write ( ( 'begin %o %s\n' % ( ( mode & 511 ) , filename ) ) ) chunk = read ( 45 ) while chunk : write ( b2a_uu ( chunk ) ) chunk = read ( 45 ) write ( ' \nend\n' ) return ( outfile . getvalue ( ) , len ( input ) )
encodes the object input and returns a tuple .