'Add an input to a path and return its tip and label locations.'

def _add_input(self, path, angle, flow, length):

    if (angle is None):
        return ([0, 0], [0, 0])
    else:
        (x, y) = path[(-1)][1]
        dipdepth = ((flow / 2) * self.pitch)
        if (angle == RIGHT):
            x -= length
            dip = [(x + dipdepth), (y + (flow / 2.0))]
            path.extend([(Path.LINETO, [x, y]), (Path.LINETO, dip), (Path.LINETO, [x, (y + flow)]), (Path.LINETO, [(x + self.gap), (y + flow)])])
            label_location = [(dip[0] - self.offset), dip[1]]
        else:
            x -= self.gap
            if (angle == UP):
                sign = 1
            else:
                sign = (-1)
            dip = [(x - (flow / 2)), (y - (sign * (length - dipdepth)))]
            if (angle == DOWN):
                quadrant = 2
            else:
                quadrant = 1
            if self.radius:
                path.extend(self._arc(quadrant=quadrant, cw=(angle == UP), radius=self.radius, center=((x + self.radius), (y - (sign * self.radius)))))
            else:
                path.append((Path.LINETO, [x, y]))
            path.extend([(Path.LINETO, [x, (y - (sign * length))]), (Path.LINETO, dip), (Path.LINETO, [(x - flow), (y - (sign * length))])])
            path.extend(self._arc(quadrant=quadrant, cw=(angle == DOWN), radius=(flow + self.radius), center=((x + self.radius), (y - (sign * self.radius)))))
            path.append((Path.LINETO, [(x - flow), (y + (sign * flow))]))
            label_location = [dip[0], (dip[1] - (sign * self.offset))]
        return (dip, label_location)
