Why not just try to make the path and then check it?
def path_type(my_path):
if os.path.exists(my_path):
return 'dir'
else:
try:
p = os.path.makedirs(my_path)
os.remove(p)
return 'dir'
except:
pass
return 'file'