code: def int_to_bytes(int_value: int, length: int) -> bytes:
      
      if length == 1:
          fmt = "!B"
      elif length == 2:
          fmt = "!H"
      return pack(fmt, int_value)
docs: convert an integer to a sequence of bytes using big endian byte ordering
      :param int_value: integer value to convert
      :param length: (optional) byte length
      :return: byte sequence