<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def load_public_key(vm_):
    '''
    Load the public key file if exists.
    '''
    public_key_filename = config.get_cloud_config_value(
        'ssh_public_key', vm_, __opts__, search_global=False, default=None
    )
    if public_key_filename is not None:
        public_key_filename = os.path.expanduser(public_key_filename)
        if not os.path.isfile(public_key_filename):
            raise SaltCloudConfigError(
                'The defined ssh_public_key \'{0}\' does not exist'.format(
                    public_key_filename
                )
            )

        with salt.utils.files.fopen(public_key_filename, 'r') as public_key:
            key = salt.utils.stringutils.to_unicode(public_key.read().replace('\n', ''))

            return key