def fuel_requirement(module_mass):
    """
    Fuel required to launch a given module is based on its mass. Specifically, to find the fuel required for a module,
    take its mass, divide by three, round down, and subtract 2. Repeat this for the weight of the fuel until the added
    weight is 0.

    :param module_mass:
    :return: fuel_requirement
    """
    total = 0
    current_mass = module_mass

    while (current_mass // 3 - 2) > 0:
        current_mass = current_mass // 3 - 2
        total += current_mass

    return total