<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _pathways_to_flux(self, paths, pathfluxes, n=None):
 r"""Sums up the flux from the pathways given Parameters paths : list of int-arrays list of pathways pathfluxes : double-array array with path fluxes n : int number of states. If not set, will be automatically determined. Returns ------- flux : (n,n) ndarray of float the flux containing the summed path fluxes """

        if (n is None):
            n = 0
            for p in paths:
                n = max(n, np.max(p))
            n += 1

        # initialize flux
        F = np.zeros((n, n))
        for i in range(len(paths)):
            p = paths[i]
            for t in range(len(p) - 1):
                F[p[t], p[t + 1]] += pathfluxes[i]
        return F