<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def copytree(src, dst):
 """Recursively copies the source directory to the destination only if the files are newer or modified by using rsync. """

    from os import path, waitpid
    from subprocess import Popen, PIPE

    #Append any trailing / that we need to get rsync to work correctly.
    source = path.join(src, "")
    desti = path.join(dst, "")
    if not path.isdir(desti):
        from os import mkdir
        mkdir(desti)
    
    prsync = Popen("rsync -t -u -r {} {}".format(source, desti), close_fds=True,
                    shell=True, executable="/bin/bash", stdout=PIPE, stderr=PIPE)
    waitpid(prsync.pid, 0)
    #Redirect the output and errors so that we don't pollute stdout.
    #output = prsync.stdout.readlines()
    error = prsync.stderr.readlines()
    prsync.stderr.close()
    prsync.stdout.close()

    if len(error) > 0:
        from fortpy.msg import warn
        warn("Error while copying {} using rsync.\n\n{}".format(source, '\n'.join(error)))