def METHOD_NAME(cls, password: Optional[bytes]) -> 'KeyPair':
    """
    :raises WalletLocked: wallet password was not provided
    """
    if not password:
        raise WalletLocked
    new_key = ec.generate_private_key(ec.SECP256K1(), default_backend())
    assert isinstance(new_key, ec.EllipticCurvePrivateKeyWithSerialization)
    private_key_bytes = get_private_key_bytes(new_key,
                                              encryption_algorithm=serialization.BestAvailableEncryption(password))
    address = get_address_b58_from_public_key(new_key.public_key())
    return cls(private_key_bytes=private_key_bytes, address=address, used=False)