parameters: (self, write_address, write_contents)
return_statement: return True
docstring: >>> c.write_memory(0x100000, b"\\xff\\xff\\xff\\xff")
          True
          >>> c.read_memory(0x100000, 4)
          b'\\xff\\xff\\xff\\xff'
          >>> c.write_memory(0x100000, b"\\x07\\x00\\x00\\xeb")
          True
          >>> c.read_memory(0x100000, 4)
          b'\\x07\\x00\\x00\\xeb'
docstring_summary: >>> c.write_memory(0x100000, b"\\xff\\xff\\xff\\xff")
          True
          >>> c.read_memory(0x100000, 4)
          b'\\xff\\xff\\xff\\xff'
          >>> c.write_memory(0x100000, b"\\x07\\x00\\x00\\xeb")
          True
          >>> c.read_memory(0x100000, 4)
          b'\\x07\\x00\\x00\\xeb'
docstring_tokens: >>> c . write_memory ( 0x100000 b \\ xff \\ xff \\ xff \\ xff ) True >>> c . read_memory ( 0x100000 4 ) b \\ xff \\ xff \\ xff \\ xff >>> c . write_memory ( 0x100000 b \\ x07 \\ x00 \\ x00 \\ xeb ) True >>> c . read_memory ( 0x100000 4 ) b \\ x07 \\ x00 \\ x00 \\ xeb
function: def write_memory(self, write_address, write_contents):
          """
          >>> c.write_memory(0x100000, b"\\xff\\xff\\xff\\xff")
          True
          >>> c.read_memory(0x100000, 4)
          b'\\xff\\xff\\xff\\xff'
          >>> c.write_memory(0x100000, b"\\x07\\x00\\x00\\xeb")
          True
          >>> c.read_memory(0x100000, 4)
          b'\\x07\\x00\\x00\\xeb'
          """
          write_size = len(write_contents)
          while write_size > 0:
              temp_write_size = min(write_size, MAX_REQUEST_DATA_SIZE - 8)
              request_data = struct.pack("II", write_address, temp_write_size)
              request_data += write_contents[:temp_write_size]
              request, request_id = self._generate_header(RequestType.WriteMemory, len(request_data))
              request += request_data
              self.socket.sendto(request, (self.address, CITRA_PORT))
  
              raw_reply = self.socket.recv(MAX_PACKET_SIZE)
              reply_data = self._read_and_validate_header(raw_reply, request_id, RequestType.WriteMemory)
  
              if None != reply_data:
                  write_address += temp_write_size
                  write_size -= temp_write_size
                  write_contents = write_contents[temp_write_size:]
              else:
                  return False
          return True
function_tokens: def write_memory ( self , write_address , write_contents ) : write_size = len ( write_contents ) while write_size > 0 : temp_write_size = min ( write_size , MAX_REQUEST_DATA_SIZE - 8 ) request_data = struct . pack ( "II" , write_address , temp_write_size ) request_data += write_contents [ : temp_write_size ] request , request_id = self . _generate_header ( RequestType . WriteMemory , len ( request_data ) ) request += request_data self . socket . sendto ( request , ( self . address , CITRA_PORT ) ) raw_reply = self . socket . recv ( MAX_PACKET_SIZE ) reply_data = self . _read_and_validate_header ( raw_reply , request_id , RequestType . WriteMemory ) if None != reply_data : write_address += temp_write_size write_size -= temp_write_size write_contents = write_contents [ temp_write_size : ] else : return False return True