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
    if port_num > 16:
        cpld_addr = 33
    else:
        cpld_addr = 32
    file_path = "/sys/bus/i2c/devices/1-00" + \
        str(cpld_num) + "/port" + str(port_num) + "/port" + str(port_num) + "_lpmode"
    try:
        reg_file = open(file_path, "r+")
    except IOError as e:
        print("Error: unable to open file: %s" % str(e))
        return False
    # LPMode is active high; set or clear the bit accordingly
    if lpmode is True:
        reg_value = 1
    else:
        reg_value = 0
    # Convert our register value back to a hex string and write back
    content = hex(reg_value)
    reg_file.seek(0)
    reg_file.write(content)
    reg_file.close()
    return True