from pathlib import Path
Path('/usr/var/log').relative_to('/usr/var/log/')
Path('/usr/var/log').relative_to('/usr/var/')
Path('/usr/var/log').relative_to('/etc/')
Python: Get relative path from comparing two absolute paths