"""Functions to help Azara and Rui locate pirate treasure."""defget_coordinate(record):"""Return coordinate value from a tuple containing the treasure name, and treasure coordinate.
:param record: tuple - with a (treasure, coordinate) pair.
:return: str - the extracted map coordinate.
"""coordinate=record[1]returncoordinatedefconvert_coordinate(coordinate):"""Split the given coordinate into tuple containing its individual components.
:param coordinate: str - a string map coordinate
:return: tuple - the string coordinate split into its individual components.
"""returntuple((coordinate))defcompare_records(azara_record,rui_record):"""Compare two record types and determine if their coordinates match.
:param azara_record: tuple - a (treasure, coordinate) pair.
:param rui_record: tuple - a (location, tuple(coordinate_1, coordinate_2), quadrant) trio.
:return: bool - do the coordinates match?
"""returntuple(azara_record[1])==rui_record[1]defcreate_record(azara_record,rui_record):"""Combine the two record types (if possible) and create a combined record group.
:param azara_record: tuple - a (treasure, coordinate) pair.
:param rui_record: tuple - a (location, coordinate, quadrant) trio.
:return: tuple or str - the combined record (if compatible), or the string "not a match" (if incompatible).
"""returnazara_record+rui_recordifcompare_records(azara_record,rui_record)else"not a match"defclean_up(combined_record_group):"""Clean up a combined record group into a multi-line string of single records.
:param combined_record_group: tuple - everything from both participants.
:return: str - everything "cleaned", excess coordinates and information are removed.
The return statement should be a multi-lined string with items separated by newlines.
(see HINTS.md for an example).
"""report=""foritemincombined_record_group:iftuple(item[1])==item[3]:report+=f"""('{item[0]}', '{item[2]}', {item[3]}, '{item[4]}')\n"""returnreport