<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_service_address( self, block_identifier: BlockSpecification, index: int, ) -> Optional[AddressHex]: """Gets the address of a service by index. If index is out of range return None"""

        try:
            result = self.proxy.contract.functions.service_addresses(index).call(
                block_identifier=block_identifier,
            )
        except web3.exceptions.BadFunctionCallOutput:
            result = None
        return result