from pathlib import Path


def basename(var, orig = False):
	"""Get the basename of a path"""
	bname = Path(var).name
	if orig or not bname.startswith('['):
		return bname

	return bname[bname.find(']')+1:]