<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def gen(nodes, n, graph):
 # TODO There could be a more convenient way of doing this. This generators # single purpose is to prepare data for multiprocessing's starmap function. """ Generator for applying multiprocessing. Parameters nodes : list List of nodes in the system. n : int Number of desired multiprocessing units. graph : :class:`networkx.classes.multigraph.MultiGraph Graph representation of an electrical grid. Returns ------- None """


    g = graph.copy()

    for i in range(0, len(nodes), n):
        yield (nodes[i:i + n], g)