'Returns only the filename from a full path. If the argument
with_extension is False, return the filename without
extension.
Examples::
>>> from lettuce.fs import FileSystem
>>> assert FileSystem.filename(\'/full/path/to/some_file.py\') == \'some_file.py\'
>>> assert FileSystem.filename(\'/full/path/to/some_file.py\', False) == \'some_file\''

@classmethod
def filename(cls, path, with_extension=True):

    fname = os.path.split(path)[1]
    if (not with_extension):
        fname = os.path.splitext(fname)[0]
    return fname
