call the function os.path.abspath with an argument dirpath, if it starts with return value of the method os.path.dirname,
if os . path . abspath ( dirpath ) . startswith ( os . path . dirname ( path ) ) :