<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_address_has_code( client: 'JSONRPCClient', address: Address, contract_name: str = '', ):
 """ Checks that the given address contains code. """

    result = client.web3.eth.getCode(to_checksum_address(address), 'latest')

    if not result:
        if contract_name:
            formated_contract_name = '[{}]: '.format(contract_name)
        else:
            formated_contract_name = ''

        raise AddressWithoutCode(
            '{}Address {} does not contain code'.format(
                formated_contract_name,
                to_checksum_address(address),
            ),
        )