def hex_to_address(val):
    """Converts hex string to a clean Ethereum address.
    
    Accepts padded or unpadded values.
    
    Returns a 0x formatted address (string).
    """
    
    return "0x{}".format(val[-40:])