def _dict_from_weights(weights: str) -> dict:
    """Returns a dictionary of lang, codes, pairs if the provided weights is supported."""
    if weights in _weights2pairs():
        pairs = _weights2pairs()[weights]
        return {
            "langs": tuple(pair[0] for pair in pairs),
            "codes": tuple(pair[1] for pair in pairs),
            "pairs": dict(pairs),
        }
    elif weights.lower() in _weights2pairs():
        pairs = _weights2pairs()[weights.lower()]
        return {
            "langs": tuple(pair[0] for pair in pairs),
            "codes": tuple(pair[1] for pair in pairs),
            "pairs": dict(pairs),
        }

    else:
        error_message = f"Incorrect argument '{weights}' for parameter weights. Please choose from: {list(_weights2pairs().keys())}"
        raise ValueError(error_message)
Returns a dictionary of lang, codes, pairs if the provided weights is supported.
dl_translate/utils.py