code: def parse_mtl(mtl):
      
      # decode bytes if necessary
      if hasattr(mtl, 'decode'):
          mtl = mtl.decode('utf-8')
  
      mtllib = None
      mtllibs = []
  
      # use universal newline splitting
      for line in str.splitlines(str(mtl).strip()):
          # clean leading/trailing whitespace and split
          line_split = line.strip().split()
          # needs to be at least two values
          if len(line_split) <= 1:
              continue
          # store the keys
          key = line_split[0]
          if key == 'newmtl':
              if mtllib:
                  mtllibs.append(mtllib)
              mtllib = {'newmtl': line_split[1],
                        'map_Kd': None,
                        'Kd': None}
          elif key == 'map_Kd':
              mtllib[key] = line_split[1]
          elif key == 'Kd':
              mtllib[key] = [float(x) for x in line_split[1:]]
      if mtllib:
          mtllibs.append(mtllib)
  
      return mtllibs
docs: Parse a loaded MTL file.
  
      Parameters
      -------------
      mtl : str or bytes
        Data from an MTL file
  
      Returns
      ------------
      mtllibs : list of dict
        Each dict has keys: newmtl, map_Kd, Kd