def get_trf_command(command, transformation=''):
    """
    Return the last command in the full payload command string.
    Note: this function returns the last command in job.command which is only set for containers.

    :param command: full payload command (string).
    :param transformation: optional name of transformation, e.g. Sim_tf.py (string).
    :return: trf command (string).
    """
    payload_command = ''
    if command:
        if not transformation:
            payload_command = command.split(';')[-2]
        elif transformation in command:
            payload_command = command[command.find(transformation):]
        payload_command = payload_command.strip()
        payload_command = payload_command.replace("'", '')
        payload_command = payload_command.rstrip(';')
    return payload_command
