def _get_interest_factor(mortgage_rate, num_years=30):
    """
    Returns a factor for converting between rents and prices
    given borrowing assumptions.

    Parameters:
    -----------
    mortgage_rate: numeric or pandas.Series
        Morgtage rate assumption(s).
    num_years: optional, int, default 30
        Number of years in the mortgage.

    Returns:
    --------
    numeric or pandas.Series

    """
    num_months = 12 * num_years
    monthly_interest = mortgage_rate / 12

    numer = ((1 + monthly_interest) ** num_months) - 1
    denom = ((1 + monthly_interest) ** num_months) * monthly_interest

    return numer / denom