Purging unused data from Python
override = bpy.context.copy()
override["area.type"] = ['OUTLINER']
override["display_mode"] = ['ORPHAN_DATA']
bpy.ops.outliner.orphans_purge(override) 


you can call every operator with a dictionary in its call in first place (if there are more than one attributes to pass). this dictionary holds the information you want to override from the normal context. you dont have to name the override like this, any other name will do, too.

the thing is, i cannot help you a hundred percent, because I dont really know which parts of the context you have to overwrite. at least in 2.8, "area.type" and "display_mode" are not part of the original context, so you are trying to override something which isnt there, so the context still stays the same like without overriding at all.

i also dont know what you do have to overwrite, because right now i really dont have time to figure that out, sry, I am myself only learning all of this. you can however see whats part of the original context if you type following into the python console:

override = bpy.context.copy()
override


it will list you everything that is in the original context, maybe you find out what you want to overwrite.