def METHOD_NAME(cxn):
    """
    Clean up remote machine before taking snapshot.
    """
    cxn.run(r'rm -rf /tmp/* /var/tmp/*')
    cxn.run(r'history -c')
    cxn.run(r'cat /dev/null > /root/.bash_history')
    cxn.run(r'unset HISTFILE')
    cxn.run(r'apt-get -y autoremove')
    cxn.run(r'apt-get -y autoclean')
    cxn.run(r'find /var/log -mtime -1 -type f -exec truncate -s 0 {} \;')
    cxn.run(r'rm -rf /var/log/*.gz /var/log/*.[0-9] /var/log/*-????????')
    cxn.run(r'rm -rf /var/lib/cloud/instances/*')
    cxn.run(r'rm -rf /var/lib/cloud/instance')
    cxn.run(r': > /var/mail/$USER')
    cxn.run(r'echo "Removing keys..."')
    cxn.run(r'rm -f /root/.ssh/authorized_keys /etc/ssh/*key*')
    cxn.run(r'echo "Compressing image..."')
    cxn.run(r'dd if=/dev/zero of=/zerofile; sync; rm /zerofile; sync')
    cxn.run(r'cat /dev/null > /var/log/lastlog; cat /dev/null > /var/log/wtmp')