def an(Rtw, y=1):
    """The time-weighted return expressed as an annual rate,
    then you need to annualize it using this function.

    Args:
        Rtw: Time-weighted return
        y: Number of years for the period

    Returns:
        Time-weighted return expressed as an annual rate

    Example:
        If you want to express your time-weighted return
        as an annual rate, here's how you can do it for 2
        years period:

        >>> import malee
        >>> malee.an(0.3662, 2)
        0.1688455843266894
    """
    return (1 + Rtw) ** (1 / y) - 1