<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(username, private_key, generate_nonce=None, iat=None, algorithm=DEFAULT_ALGORITHM):
 """ Create a signed JWT using the given username and RSA private key. :param username: Username (string) to authenticate as on the remote system. :param private_key: Private key to use to sign the JWT claim. :param generate_nonce: Optional. Callable to use to generate a new nonce. Defaults to `random.random <https://docs.python.org/3/library/random.html#random.random>`_. :param iat: Optional. Timestamp to include in the JWT claim. Defaults to `time.time <https://docs.python.org/3/library/time.html#time.time>`_. :param algorithm: Optional. Algorithm to use to sign the JWT claim. Default to ``RS512``. See `pyjwt.readthedocs.io <https://pyjwt.readthedocs.io/en/latest/algorithms.html>`_ for other possible algorithms. :return: JWT claim as a string. """

    iat = iat if iat else time.time()
    if not generate_nonce:
        generate_nonce = lambda username, iat: random.random()  # NOQA

    token_data = {
        'username': username,
        'time': iat,
        'nonce': generate_nonce(username, iat),
    }

    token = jwt.encode(token_data, private_key, algorithm=algorithm)
    return token