import math


def apparent_to_absolute(d_pc, mag):
    """
    Converts apparent magnitude to absolute magnitude, given a distance to the object in pc.

    INPUTS
    d_pc: Distance to the object in parsecs.
    mag: Apparent magnitude.

    OUTPUT
    absMag: Absolute magnitude.
    """

    absMag = mag - 5.0 * math.log10(d_pc / 10.0)
    return absMag