def METHOD_NAME(self, port_num, lpmode):
    # Check for invalid port_num
    if port_num < self.port_start or port_num > self.port_end:
        return False
    path = ATTR_PATH+QSFP_LOWPOWER_FILE.format(port_num+1)
    try:
        reg_file = open(path, 'w')
    except IOError as e:
        print("Error: unable to open file: %s" % str(e))
        return False
    # the gpio pin is ACTIVE_HIGH
    if lpmode is True:
        val = "1"
    else:
        val = "0"
    # write value to gpio
    reg_file.seek(0)
    reg_file.write(val)
    reg_file.close()
    return True