def METHOD_NAME(traj, charges, temperature):
    """Calculate the static dielectric constant from a trajectory.
    Parameters
    ----------
    traj : Trajectory
        An mdtraj trajectory.
    charges : np.ndarray, shape=(n_atoms), dtype=float
       Charges of each atom in the topology, expressed in units of the
       elementary charge constant.
    temperature : temperature, float
        The temperature of interest, in units of kelvin.
    Returns
    -------
    static_dielectric : float,
        The (unitless) relative static dielectric constant.
    Notes
    -----
    See eqn. (2) in 10.1021/jp3002383 or eqn. (7) in 10.1063/1.1476316
    or https://github.com/gromacs/gromacs/blob/master/src/gromacs/gmxana/gmx_current.c#L622
    """
    temperature = temperature * u.kelvin
    moments = dipole_moments(traj, charges)
    mu = moments.mean(0)  # Mean over frames
    subtracted = moments - mu
    dipole_variance = (subtracted * subtracted).sum(-1).mean(0) * (u.elementary_charge * u.nanometers) ** 2.  # <M*M> - <M>*<M> = <(M - <M>) * (M - <M>)>
    volume = traj.unitcell_volumes.mean() * u.nanometers ** 3.  # Average box volume of trajectory
    METHOD_NAME = 1.0 + dipole_variance / (3 * kB * temperature * volume * epsilon0)  # Eq. 7 of Derivation of an improved simple point charge model for liquid water: SPC/A and SPC/L
    # Also https://github.com/gromacs/gromacs/blob/master/src/gromacs/gmxana/gmx_current.c#L622
    return METHOD_NAME