def METHOD_NAME(self, algorithm):
    """
    Ensure that the nominated algorithm is recognized, and that cryptography is installed for those
    algorithms that require it
    """
    if algorithm not in ALLOWED_ALGORITHMS:
        raise TokenBackendError(format_lazy(_("Unrecognized algorithm type '{}'"), algorithm))
    if algorithm in algorithms.requires_cryptography and not algorithms.has_crypto:
        raise TokenBackendError(format_lazy(_("You must have cryptography installed to use {}."), algorithm))