<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _generate_new_address(self, creator=None) -> str: """Generates a new address for the global state. :return: """

        if creator:
            # TODO: Use nounce
            return "0x" + str(mk_contract_address(creator, 0).hex())
        while True:
            address = "0x" + "".join([str(hex(randint(0, 16)))[-1] for _ in range(40)])
            if address not in self.accounts.keys():
                return address