import math


def length(line):
    """Returns the Manhattan length of the given line segment.
    """
    (point1, point2) = list(line.boundary)
    return (math.fabs(point1.x - point2.x) + math.fabs(point1.y - point2.y))