def METHOD_NAME(filename):
    triangles = list()
    with open(filename, "rb") as fd:
        start = fd.read(5)
        if start == b'solid':
            stl_type = 'ascii'
        else:
            stl_type = 'binary'
    print(start)
    if stl_type == 'ascii':
        with open(filename, "r") as fd:
            triangle = {
                'normal': [0, 0, 0],
                'points': list()
            }
            for line in fd:
                line = line.strip()
                if line.startswith('solid'):
                    continue
                elif line.startswith('endsolid'):
                    continue
                elif line.startswith('outer'):
                    continue
                elif line.startswith('facet'):
                    parts = line.split(' ')
                    for i in range(2, 5):
                        triangle['normal'][i-2] = float(parts[i])
                    continue
                elif line.startswith('vertex'):
                    parts = line.split(' ')
                    point = [0, 0, 0]
                    for i in range(1, 4):
                        point[i-1] = float(parts[i])
                    triangle['points'].append(point)
                    continue
                elif line.startswith('endloop'):
                    continue
                elif line.startswith('endfacet'):
                    triangles.append(triangle)
                    triangle = {
                        "normal": [0, 0, 0],
                        "points": list()
                    }
                    continue
    else:  # binary
        with open(filename, "rb") as fd:
            data = fd.read()
            count = int.from_bytes(data[80:84], byteorder='little')
            for offset in range(84, 84+count*(12*4+2), 12*4+2):
                try:
                    triangle = {
                        'points': list()
                    }
                    triangle['normal'] = list(
                        struct.unpack('fff', data[offset:offset+12]))
                    for p in range(1,4):
                        pnt = struct.unpack('fff',
                            data[offset+p*12:offset+p*12+12])
                        triangle['points'].append(pnt)
                    triangles.append(triangle)
                except struct.error:
                    print("Invalid binary stl format")
                    return None
    return Mesh(
        triangles=triangles
    )