def get_line_svg_text(
    x1, y1, x2, y2,
    outline_color=None,
    outline_width=0,
):
    """Return SVG text representing file with a line."""
    ### represent points as 2d vectors

    v1 = Vector2(x1, y1)
    v2 = Vector2(x2, y2)

    ### define bounding area of points

    points_bounding_area = Rect(get_rect_from_points(v1, v2))

    ### offset it to origin, moving the points along with it by the
    ### same amount
    points_bounding_offset = -Vector2(points_bounding_area.topleft)

    points_bounding_area.move_ip(points_bounding_offset)

    v1 += points_bounding_offset
    v2 += points_bounding_offset

    ### create an additional stroke bounding area, by adding extra
    ### padding to the points bounding area;
    ###
    ### this area accounts for the extra space taken by the line
    ### thickness, that is, the thickness of the stroke
    stroke_bounding_area = points_bounding_area.inflate((outline_width,)*2)

    ### offset stroke bounding area area to origin and move points by the
    ### same amount
    ###
    ### we do not move the points bounding area because at this point we
    ### won't need it anymore

    stroke_bounding_offset = -Vector2(stroke_bounding_area.topleft)

    stroke_bounding_area.move_ip(stroke_bounding_offset)

    v1 += stroke_bounding_offset
    v2 += stroke_bounding_offset

    ### now redefine the points coordinates and the svg dimensions with
    ### the points and stroke bounding area

    x1, y1 = v1
    x2, y2 = v2

    width, height = stroke_bounding_area.size

    stroke_color = _format_color(outline_color)

    ### finally pass our data to a str.format() instance that formats
    ### the data into a string representing the contents of a svg file
    ### describing our line, returning such string

    return (
        LINE_FORMATTER(
            width=width,
            height=height,
            x1=x1, y1=y1, x2=x2, y2=y2,
            stroke_color=stroke_color,
            stroke_width=outline_width,
        )
    )
Return SVG text representing file with a line.
nodezator/svgutils.py