<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sign_message(message, private_key, public_key=None):
 """ Signs a `message` using `private_key` and `public_key` .. warning:: Not safe to use with secret keys or secret data. See module docstring. This function should be used for testing only. :param message: the message to sign :type message: bytes :param private_key: private key used to sign message :type private_key: bytes :param public_key: public key used to sign message :type public_key: bytes :return: the signature of the signed message :rtype: bytes """


    if public_key is None:
        public_key = private_to_public_key(private_key)

    return ed25519_blake2.signature_unsafe(message, private_key, public_key)