Not sure what you mean by "work of", but Python is a dynamically typed
language so you can really pass whatever type you want to the function.
> ext = filename.split('.')[-1]
looks like the filename parameter is most likely expected to be a string
and this line:
> if instance.pk
indicates that instance is something that is expected to have a pk
member in some (most?) cases.
What exactly is this function and where did you get it from?
I'm assuming you didn't write it yourself.
A bit more context would make it a lot easier for someone to help you.