<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def refresh_ip(self, si, logger, session, vcenter_data_model, resource_model, cancellation_context, app_request_json):
 """ Refreshes IP address of virtual machine and updates Address property on the resource :param vim.ServiceInstance si: py_vmomi service instance :param logger: :param vCenterShell.driver.SecureCloudShellApiSession session: cloudshell session :param GenericDeployedAppResourceModel resource_model: UUID of Virtual Machine :param VMwarevCenterResourceModel vcenter_data_model: the vcenter data model attributes :param cancellation_context: """

        self._do_not_run_on_static_vm(app_request_json=app_request_json)

        default_network = VMLocation.combine(
            [vcenter_data_model.default_datacenter, vcenter_data_model.holding_network])

        match_function = self.ip_manager.get_ip_match_function(
            self._get_ip_refresh_ip_regex(resource_model.vm_custom_params))

        timeout = self._get_ip_refresh_timeout(resource_model.vm_custom_params)

        vm = self.pyvmomi_service.find_by_uuid(si, resource_model.vm_uuid)

        ip_res = self.ip_manager.get_ip(vm, default_network, match_function, cancellation_context, timeout, logger)

        if ip_res.reason == IpReason.Timeout:
            raise ValueError('IP address of VM \'{0}\' could not be obtained during {1} seconds'
                             .format(resource_model.fullname, timeout))

        if ip_res.reason == IpReason.Success:
            self._update_resource_address_with_retry(session=session,
                                                     resource_name=resource_model.fullname,
                                                     ip_address=ip_res.ip_address)

            return ip_res.ip_address