to make this more general perhaps do - that way name source can simply be a string input as well.

```
try:
   _, base, _ = split_filename(source)
except:
    base = source
```