def set_memory(self, address, new_memory):
    if (type(address) == str):
        if ('0x' in address):
            address = int(address, 16)
    if (type(new_memory) != str):
        raise IndexError(('Memory Inputed by set_memory() function of Virtual Memory is not a valid type. Type: ' + str(type(new_memory))))
    if (new_memory[0:2] == '0x'):
        new_memory = new_memory[2:]
    memory_start = (address - self.start_address)
    if ((address < self.start_address) or (address > (self.start_address + self.allocated_memory)) or ((address + (len(new_memory) / 2)) > (self.start_address + self.allocated_memory))):
        raise IndexError(((('Address accessed by set_memory() function of Virtual Memory is outside the range of the allocated memory. Address: ' + str(hex(address))) + '-') + str(((((hex(int((address + (len(new_memory) / 2)))) + ', Allocated Memory: ') + str(hex(self.start_address))) + '-') + str(hex((self.start_address + self.allocated_memory)))))))
    if ((len(new_memory) % 2) != 0):
        new_memory = (new_memory + self.memory[int((memory_start + (len(new_memory) / 2)))][1])
    self.memory[memory_start:int((memory_start + (len(new_memory) / 2)))] = findall('..', new_memory)
def set_memory(self, address, new_memory):
    if (type(address) == str):
        if ('0x' in address):
            address = int(address, 16)
    if (type(new_memory) != str):
        raise IndexError(('Memory Inputed by set_memory() function of Virtual Memory is not a valid type. Type: ' + str(type(new_memory))))
    if (new_memory[0:2] == '0x'):
        new_memory = new_memory[2:]
    memory_start = (address - self.start_address)
    if ((address < self.start_address) or (address > (self.start_address + self.allocated_memory)) or ((address + (len(new_memory) / 2)) > (self.start_address + self.allocated_memory))):
        raise IndexError(((('Address accessed by set_memory() function of Virtual Memory is outside the range of the allocated memory. Address: ' + str(hex(address))) + '-') + str(((((hex(int((address + (len(new_memory) / 2)))) + ', Allocated Memory: ') + str(hex(self.start_address))) + '-') + str(hex((self.start_address + self.allocated_memory)))))))
    if ((len(new_memory) % 2) != 0):
        new_memory = (new_memory + self.memory[int((memory_start + (len(new_memory) / 2)))][1])
    self.memory[memory_start:int((memory_start + (len(new_memory) / 2)))] = findall('..', new_memory)