import os

from .las import LASHandler as las
from .ply import PLYHandler as ply

io_handlers = {
    'ply': ply,
    'las': las,
    'laz': las,
}


def get_io_handler(path, mode, format=None, overwrite=False):
    if format is None:
        format = os.path.splitext(path)[-1]
    format = format.lower()
    check_format(format)
    io_handler = io_handlers[format]
    return io_handler(path, mode, overwrite=overwrite)


def check_format(format):
    if format in io_handlers:
        pass
    else:
        raise NotImplementedError(
            "File format %s unknown. Implemented formats are: %s" % (format, ', '.join(io_handlers.keys())))

@@ -1,15 +1,4 @@
-import os%0A%0A
 from
@@ -238,11 +238,8 @@
 t = 
-os.
 path
@@ -248,16 +248,12 @@
 plit
-ext(path
+('.'
 )%5B-1

use formats without leading period