def conversion(amount, rates, output_currency=None):
    """
    Converts amount from input currency to the output currency. If output
    currency is not defined, conversion is made for all supported currencies.

    Parameters
    ----------
    amount : float
        Amount of money to be converted.
    rates : dict
        Conversion rates.
    output_currency : str, optional
        Currency for which conversion is made.

    Returns
    -------
    dict
        Converted rates.
    """

    result = {
        k: round(v * amount, 2) for k, v in rates.items()
    }  # it is necessary to have float(amount)?

    if output_currency:
        result = {output_currency: result[output_currency]}

    return result