import math


def get_fronthaul_costs(region, costs):
    """
    Calculate fronthaul costs.

    Parameters
    ----------
    region : dict
        The region being assessed and all associated parameters.
    costs : dict
        All equipment costs.

    Returns
    -------
    cost : int
        Fiber fronthaul cost.

    """
    average_cell_spacing_m = (math.sqrt(1/region['network_site_density']) / 2) * 1000

    tech = 'fiber_{}_m'.format(region['geotype'].split(' ')[0])
    cost_per_meter = costs[tech]
    cost = int(cost_per_meter * average_cell_spacing_m)

    return cost