<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _head_length(self, port):
 """Distance from the center of the port to the perpendicular waypoint"""

        if not port:
            return 0.
        parent_state_v = self.get_parent_state_v()
        if parent_state_v is port.parent:  # port of connection's parent state
            return port.port_size[1]
        return max(port.port_size[1] * 1.5, self._calc_line_width() / 1.3)