def METHOD_NAME(key_size=2048):
    if key_size not in RSA_KEY_SIZES:
        raise RSAUsageError("Key size {} is not supported by MCUboot"
                            .format(key_size))
    pk = rsa.generate_private_key(
        public_exponent=65537,
        key_size=key_size,
        backend=default_backend())
    return RSA(pk)