import math


def get_similar_lag(freq_in_days):
    """For a given frequency, it returns a lag which is likely to be most correlated
    to the observation at current time.

    For daily data, this will return 7 and for hourly data it will return 24*7.
    In general for sub-weekly frequencies, it returns the lag which corresponds to
    the same time in the last week.
    For data which is weekly or with frequencies larger than a week, it returns None.

    Parameters
    ----------
    freq_in_days : `float`
        The time frequency of the timeseries given in day units.

    Returns
    -------
    similar_lag : `int` or None
        The returned lag or None.
    """
    similar_lag = None
    # Get the number of observations per week
    obs_num_per_week = 7 / freq_in_days

    if obs_num_per_week > 1:
        similar_lag = math.ceil(obs_num_per_week)

    return similar_lag