def find_pair(self, crypto="<STR_LIT>", fiat="<STR_LIT>", verbose=False):
self.fetch_pairs()<EOL>if not crypto and not fiat:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>def is_matched(crypto, fiat, pair):<EOL><INDENT>if crypto and not fiat:<EOL><INDENT>return pair.startswith("<STR_LIT>" % crypto)<EOL><DEDENT>if crypto and fiat:<EOL><INDENT>return pair == "<STR_LIT>" % (crypto, fiat)<EOL><DEDENT>if not crypto:<EOL><INDENT>return pair.endswith("<STR_LIT>" % fiat)<EOL><DEDENT><DEDENT>matched_pairs = {}<EOL>for Service, pairs in self._all_pairs.items():<EOL><INDENT>matched = [p for p in pairs if is_matched(crypto, fiat, p)]<EOL>if matched:<EOL><INDENT>matched_pairs[Service] = matched<EOL><DEDENT><DEDENT>return matched_pairs<EOL>
This utility is used to find an exchange that supports a given exchange pair.