def ancestor_has_staff_lock(xblock, parent_xblock=None):
 if (parent_xblock is None):
  parent_location = modulestore().get_parent_location(xblock.location, revision=ModuleStoreEnum.RevisionOption.draft_preferred)
  if (not parent_location):
   return False
  parent_xblock = modulestore().get_item(parent_location)
 return parent_xblock.visible_to_staff_only

def ancestor_has_staff_lock ( xblock , parent_xblock = None ) : if ( parent_xblock is None ) : parent_location = modulestore ( ) . get_parent_location ( xblock . location , revision = ModuleStoreEnum . RevisionOption . draft_preferred ) if ( not parent_location ) : return False parent_xblock = modulestore ( ) . get_item ( parent_location ) return parent_xblock . visible_to_staff_only
returns true iff one of xblocks ancestors has staff lock .