def mag_double_power_law(mag, phi_star, mag_star, alpha, beta):
    """Evaluate a broken double power law luminosity function as a function
    of magnitude.

    :param mag: Magnitude
    :type mag: float or np.ndarray
    :param phi_star: Normalization of the broken power law at a value of
     mag_star
    :type phi_star: float
    :param mag_star: Break magnitude of the power law
    :type mag_star: float
    :param alpha: First slope of the broken power law
    :type alpha: float
    :param beta: Second slope of the broken power law
    :type beta: float
    :return: Value of the broken double power law at a magnitude of M
    :rtype: float or np.ndarray
    """
    A = pow(10, 0.4 * (alpha + 1) * (mag - mag_star))
    B = pow(10, 0.4 * (beta + 1) * (mag - mag_star))

    return phi_star / (A + B)