Re-ordered imports
Added regex to allow for keeping . (ability to slugify filenames and keep extension, if filename doesn't contain .)
Changed type comparison to isinstance()