def _get_entity_from_href(self, result):
href_result = result['<STR_LIT>']<EOL>if self.collection._href.startswith(href_result):<EOL><INDENT>return Entity(self.collection, result, incomplete=True)<EOL><DEDENT>href_match = re.match(r"<STR_LIT>", href_result)<EOL>if not href_match:<EOL><INDENT>raise ValueError("<STR_LIT>".format(href_result))<EOL><DEDENT>collection_name = href_match.group(<NUM_LIT:2>)<EOL>entry_point = href_match.group(<NUM_LIT:1>)<EOL>new_collection = Collection(<EOL>self.collection.api,<EOL>"<STR_LIT>".format(entry_point, collection_name),<EOL>collection_name<EOL>)<EOL>return Entity(new_collection, result, incomplete=True)<EOL>
Returns entity in correct collection.

        If the "href" value in result doesn't match the current collection,
        try to find the collection that the "href" refers to.