def METHOD_NAME(session, tar_speed, tar_duplex,
                               method='traceview'):
    """
    Check the speed and duplex with certain method.
    param tar_speed: target speed expected
    param tar_duplex: target duplex expected
    param method: the method to check, one of 'traceview' and 'powershell'
    """
    if method == 'traceview':
        speed, duplex = get_speed_duplex_traceview()
    elif method == 'powershell':
        speed, duplex = get_speed_duplex_powershell(session)
    else:
        test.error("Method %s not supported", method)
    if speed != tar_speed or duplex != tar_duplex:
        test.fail("The speed and duplex is incorrect in %s, "
                  "with speed=%s, duplex=%s" % (method, speed, duplex))