def METHOD_NAME(self, port_num):
    # Check for invalid port_num
    if port_num < self.port_start or port_num > self.port_end:
        return False
    try:
        if port_num < self.qsfp_port_start:
            reg_file = open("/sys/class/cpld-sfp28/port-"+str(port_num)+"/pre_n")
        else:
            reg_file = open("/sys/class/gpio/gpio"+str((port_num-self.qsfp_port_start)*4+34)+"/value")
    except IOError as e:
        print("Error: unable to open file: %s" % str(e))
        return False
    reg_value = reg_file.readline().rstrip()
    if port_num < self.qsfp_port_start:
        if reg_value == '1':
            return True
    else:
        if reg_value == '0':
            return True
    return False