'Change to a directory.'

def cwd(self, dirname):

    if (dirname == '..'):
        try:
            return self.voidcmd('CDUP')
        except error_perm as msg:
            if (msg.args[0][:3] != '500'):
                raise
    elif (dirname == ''):
        dirname = '.'
    cmd = ('CWD    ' + dirname)
    return self.voidcmd(cmd)
