from typing import List
from typing import Union
from typing import Tuple


def _get_coords(
    values: List[Union[float, int, None]]
) -> Tuple[
    List[Tuple[int, int, Union[float, int, None]]], List[Tuple[int, int, int, int]]
]:
    """Generate the coordinates used for rendering the nodes and edges.

    node and edges are stored as tuples in the form node: (x, y, label) and
    edge: (x1, y1, x2, y2)

    Each coordinate is relative y is the depth, x is the position of the node
    on a level from left to right 0 to 2**depth -1

    :param values: Values of the binary tree.
    :type values: list of ints
    :return: nodes and edges list
    :rtype: two lists of tuples

    """
    x = 0
    y = 0
    nodes = []
    edges = []

    # root node
    nodes.append((x, y, values[0]))
    # append other nodes and their edges
    y += 1
    for value in values[1:]:
        if value is not None:
            nodes.append((x, y, value))
            edges.append((x // 2, y - 1, x, y))
        x += 1
        # check if level is full
        if x == 2 ** y:
            x = 0
            y += 1
    return nodes, edges