Pathlib

from pathlib import Path
assert Path(<some_file>).is_file()

To get the Path of the current file, or a parent:

Path('.').resolve()
Path('.').resolve().parent

Platform

import platform
if 'macOS' in platform.platform():
    print('This is Mac')
<some_path>.mkdir(parents=True, exist_ok=True)