def _to_byte_string(value, num_bits):
 shifts = six.moves.xrange((num_bits - 8), (-8), (-8))
 def byte_at(off):
  return (((value >> off) if (off >= 0) else (value << (- off))) & 255)
 return ''.join((six.unichr(byte_at(offset)) for offset in shifts))

def _to_byte_string ( value , num_bits ) : shifts = six . moves . xrange ( ( num_bits - 8 ) , ( - 8 ) , ( - 8 ) ) def byte_at ( off ) : return ( ( ( value >> off ) if ( off >= 0 ) else ( value << ( - off ) ) ) & 255 ) return '' . join ( ( six . unichr ( byte_at ( offset ) ) for offset in shifts ) )
convert an integer to a big-endian string of bytes with padding .