@classmethod
def _get_correct_match(cls, link, matches):
    result = None
    if (len(matches) == 1):
        result = matches[0]
    elif ((len(matches) > 1) and getattr(c, 'app', None)):
        for m in matches:
            if (m.app_config_id == c.app.config._id):
                result = m
                break
        if (not result):
            cls.log_ambiguous_link('Can not remove ambiguity for link %s with c.app %s', matches, link, c.app)
            result = matches[0]
    elif ((len(matches) > 1) and (not getattr(c, 'app', None))):
        cls.log_ambiguous_link('Ambiguous link to %s and c.app is not present to remove ambiguity', matches, link)
        result = matches[0]
    return result
@classmethod
def _get_correct_match(cls, link, matches):
    result = None
    if (len(matches) == 1):
        result = matches[0]
    elif ((len(matches) > 1) and getattr(c, 'app', None)):
        for m in matches:
            if (m.app_config_id == c.app.config._id):
                result = m
                break
        if (not result):
            cls.log_ambiguous_link('Can not remove ambiguity for link %s with c.app %s', matches, link, c.app)
            result = matches[0]
    elif ((len(matches) > 1) and (not getattr(c, 'app', None))):
        cls.log_ambiguous_link('Ambiguous link to %s and c.app is not present to remove ambiguity', matches, link)
        result = matches[0]
    return result