def get_next_neighbors(indices, lattice_length, width=<NUM_LIT:0>, distance=<NUM_LIT:1>,<EOL>periodic=False):
if not isinstance(indices, list):<EOL><INDENT>indices = [indices]<EOL><DEDENT>if distance == <NUM_LIT:1>:<EOL><INDENT>return flatten(get_neighbors(index, lattice_length, width, periodic)<EOL>for index in indices)<EOL><DEDENT>else:<EOL><INDENT>s1 = set(flatten(get_next_neighbors(get_neighbors(index,<EOL>lattice_length,<EOL>width, periodic),<EOL>lattice_length, width, distance-<NUM_LIT:1>,<EOL>periodic) for index in indices))<EOL>s2 = set(get_next_neighbors(indices, lattice_length, width, distance-<NUM_LIT:1>,<EOL>periodic))<EOL>return list(s1 - s2)<EOL><DEDENT>
Get the forward neighbors at a given distance of a site or set of sites
    in a lattice.

    :param index: Linear index of operator.
    :type index: int.
    :param lattice_length: The size of the 2D lattice in either dimension
    :type lattice_length: int.
    :param width: Optional parameter to define width.
    :type width: int.
    :param distance: Optional parameter to define distance.
    :type width: int.
    :param periodic: Optional parameter to indicate periodic boundary
                     conditions.
    :type periodic: bool

    :returns: list of int -- the neighbors at given distance in linear index.