<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_port_precommit(self, context):
 """Update port pre-database transaction commit event."""

        vlan_segment, vxlan_segment = self._get_segments(
            context.top_bound_segment, context.bottom_bound_segment)
        orig_vlan_segment, orig_vxlan_segment = self._get_segments(
            context.original_top_bound_segment,
            context.original_bottom_bound_segment)

        if (self._is_vm_migrating(context, vlan_segment, orig_vlan_segment) or
            self._is_status_down(context.current)):
            vni = (self._port_action_vxlan(
                context.original, orig_vxlan_segment, self._delete_nve_db)
                if orig_vxlan_segment else 0)
            self._port_action_vlan(context.original, orig_vlan_segment,
                                   self._delete_nxos_db, vni)
        elif self._is_supported_deviceowner(context.current):
            vni = self._port_action_vxlan(context.current, vxlan_segment,
                        self._configure_nve_db) if vxlan_segment else 0
            self._port_action_vlan(context.current, vlan_segment,
                                   self._configure_nxos_db, vni)