<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def proximity_metric(self, a, b):
 """Return the weight of the dependency from a to b. Higher weights usually have shorter straighter edges. Return 1 if it has normal weight. A value of 4 is usually good for ensuring that a related pair of modules are drawn next to each other. Returns an int between 1 (unknown, default), and 4 (very related). """

        # if self._is_pylib(a) and self._is_pylib(b):
        #     return 1

        res = 1
        for ap, bp, n in zip(a.path_parts, b.path_parts, list(range(4))):
            res += ap == bp
            if n >= 3:
                break
        return res