Run a command remotly using the psexec protocol

def run_psexec_command(cmd, args, host, username, password, port=445):
    '''
    Run a command remotly using the psexec protocol
    '''
    if has_winexe() and not HAS_PSEXEC:
        ret_code = run_winexe_command(cmd, args, host, username, password, port)
        return None, None, ret_code
    service_name = 'PS-Exec-{0}'.format(uuid.uuid4())
    stdout, stderr, ret_code = '', '', None
    client = Client(host, username, password, port=port, encrypt=False, service_name=service_name)
    client.connect()
    try:
        client.create_service()
        stdout, stderr, ret_code = client.run_executable(cmd, args)
    finally:
        client.remove_service()
        client.disconnect()
    return stdout, stderr, ret_code