def find_release_date_source(xblock):
 if (xblock.category == 'chapter'):
  return xblock
 parent_location = modulestore().get_parent_location(xblock.location, revision=ModuleStoreEnum.RevisionOption.draft_preferred)
 if (not parent_location):
  return xblock
 parent = modulestore().get_item(parent_location)
 if (parent.start != xblock.start):
  return xblock
 else:
  return find_release_date_source(parent)

def find_release_date_source ( xblock ) : if ( xblock . category == 'chapter' ) : return xblock parent_location = modulestore ( ) . get_parent_location ( xblock . location , revision = ModuleStoreEnum . RevisionOption . draft_preferred ) if ( not parent_location ) : return xblock parent = modulestore ( ) . get_item ( parent_location ) if ( parent . start != xblock . start ) : return xblock else : return find_release_date_source ( parent )
finds the ancestor of xblock that set its release date .