code: def len2dlc(length):
      
      if length <= 8:
          return length
      for dlc, nof_bytes in enumerate(CAN_FD_DLC):
          if nof_bytes >= length:
              return dlc
      return 15
docs: Calculate the DLC from data length.
  
      :param int length: Length in number of bytes (0-64)
  
      :returns: DLC (0-15)
      :rtype: int