'Attempts to extract a match from candidate if the whole candidate
does not qualify as a match.
Arguments:
candidate -- The candidate text that might contain a phone number
offset -- The current offset of candidate within text
Returns the match found, None if none can be found'

def _extract_inner_match(self, candidate, offset):

    for possible_inner_match in _INNER_MATCHES:
        group_match = possible_inner_match.search(candidate)
        is_first_match = True
        while (group_match and (self._max_tries > 0)):
            if is_first_match:
                group = self._trim_after_first_match(_UNWANTED_END_CHAR_PATTERN, candidate[:group_match.start()])
                match = self._parse_and_verify(group, offset)
                if (match is not None):
                    return match
                self._max_tries -= 1
                is_first_match = False
            group = self._trim_after_first_match(_UNWANTED_END_CHAR_PATTERN, group_match.group(1))
            match = self._parse_and_verify(group, (offset + group_match.start(1)))
            if (match is not None):
                return match
            self._max_tries -= 1
            group_match = possible_inner_match.search(candidate, (group_match.start() + 1))
    return None
