def get_osa_commit(repo, ref, rpc_product=None):
osa_differ.checkout(repo, ref)<EOL>functions_path = os.path.join(repo.working_tree_dir,<EOL>'<STR_LIT>')<EOL>release_path = os.path.join(repo.working_tree_dir,<EOL>'<STR_LIT>')<EOL>if os.path.exists(release_path):<EOL><INDENT>with open(release_path) as f:<EOL><INDENT>rpc_release_data = yaml.safe_load(f.read())<EOL><DEDENT>rpc_product_releases = rpc_release_data['<STR_LIT>']<EOL>release_data = rpc_product_releases[rpc_product]<EOL>return release_data['<STR_LIT>']<EOL><DEDENT>elif repo.submodules['<STR_LIT>']:<EOL><INDENT>return repo.submodules['<STR_LIT>'].hexsha<EOL><DEDENT>elif os.path.exists(functions_path):<EOL><INDENT>quoted_re = re.compile('<STR_LIT>')<EOL>with open(functions_path, "<STR_LIT:r>") as funcs:<EOL><INDENT>for line in funcs.readlines():<EOL><INDENT>match = quoted_re.search(line)<EOL>if match:<EOL><INDENT>return match.groups()[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise SHANotFound(<EOL>("<STR_LIT>"<EOL>"<STR_LIT>".format(functions_path)))<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>raise SHANotFound('<STR_LIT>')<EOL><DEDENT>
Get the OSA sha referenced by an RPCO Repo.