import math


def line(p0, p1):
    """
    Create line between two points based on Bresenham algorithm
    """

    steep = False
    x0 = p0[0]
    y0 = p0[1]
    x1 = p1[0]
    y1 = p1[1]

    if math.fabs(x0 - x1) < math.fabs(y0 - y1):
        x0, y0 = y0, x0
        x1, y1 = y1, x1
        steep = True

    if x0 > x1:
        x0, x1 = x1, x0
        y0, y1 = y1, y0

    dx = x1 - x0
    dy = y1 - y0

    if dx == 0:
        derror = 0.1
    else:
        derror = math.fabs(dy / dx)

    error = 0.0
    y = y0
    x = x0
    points = []

    while x <= x1:
        points.append((y, x) if steep else (x, y))

        error += derror

        if error > 0.5:
            y += 1 if y1 > y0 else -1
            error -= 1.
        x += 1

    return points