def calc_geo_lines_in_buffer(network, node, grid, radius, radius_inc):
    """Determines lines in nodes' associated graph that are at least partly
    within buffer of radius from node. If there are no lines, the buffer is
    successively extended by radius_inc until lines are found.

    Parameters
    ----------
    network : :class:`~.grid.network.Network`
        The eDisGo container object
    node : :class:`~.grid.components.Component`
        Origin node the buffer is created around (e.g. :class:`~.grid.components.Generator`).
        Node must be a member of grid's graph (grid.graph)
    grid : :class:`~.grid.grids.Grid`
        Grid whose lines are searched
    radius : :obj:`float`
        Buffer radius in m
    radius_inc : :obj:`float`
        Buffer radius increment in m

    Returns
    -------
    :obj:`list` of :class:`~.grid.components.Line`
        Sorted (by repr()) list of lines

    Notes
    -----
    Adapted from `Ding0 <https://github.com/openego/ding0/blob/\
        21a52048f84ec341fe54e0204ac62228a9e8a32a/\
        ding0/tools/geo.py#L53>`_.
    """

    lines = []

    while not lines:
        node_shp = transform(proj2equidistant(network), node.geom)
        buffer_zone_shp = node_shp.buffer(radius)
        for line in grid.graph.lines():
            nodes = line['adj_nodes']
            branch_shp = transform(proj2equidistant(network), LineString([nodes[0].geom, nodes[1].geom]))
            if buffer_zone_shp.intersects(branch_shp):
                lines.append(line)
        radius += radius_inc

    return sorted(lines, key=lambda _: repr(_))
Determines lines in nodes' associated graph that are at least partly
    within buffer of radius from node. If there are no lines, the buffer is
    successively extended by radius_inc until lines are found.

    Parameters
    ----------
    network : :class:`~.grid.network.Network`
        The eDisGo container object
    node : :class:`~.grid.components.Component`
        Origin node the buffer is created around (e.g. :class:`~.grid.components.Generator`).
        Node must be a member of grid's graph (grid.graph)
    grid : :class:`~.grid.grids.Grid`
        Grid whose lines are searched
    radius : :obj:`float`
        Buffer radius in m
    radius_inc : :obj:`float`
        Buffer radius increment in m

    Returns
    -------
    :obj:`list` of :class:`~.grid.components.Line`
        Sorted (by repr()) list of lines

    Notes
    -----
    Adapted from `Ding0 <https://github.com/openego/ding0/blob/\
        21a52048f84ec341fe54e0204ac62228a9e8a32a/\
        ding0/tools/geo.py#L53>`_.