code: def int_to_bytes(i, minlen=1, order='big'):  # pragma: no cover
          
          blen = max(minlen, PGPObject.int_byte_len(i), 1)
  
          if six.PY2:
              r = iter(_ * 8 for _ in (range(blen) if order == 'little' else range(blen - 1, -1, -1)))
              return bytes(bytearray((i >> c) & 0xff for c in r))
  
          return i.to_bytes(blen, order)
docs: convert integer to bytes