code: def find_base(path):
  	
  	result = _pattern.match(path)
  
  	if result:
  		base = result.group(0)
  	else:
  		base = "./"
  
  	if base.endswith('/') or base.endswith('\\'):
  		return os.path.abspath(base)
  	else:
  		return os.path.dirname(os.path.abspath(base))
docs: Find the base of a glob.