'Search for the value based on the context.'

def _GetValue(self, name, context, default=utils.NotAValue):

    container = self.defaults
    if (default is not utils.NotAValue):
        value = default
    elif (name in self.defaults):
        value = self.defaults[name]
    else:
        raise UnknownOption(('Option    %s    not    defined.' % name))
    new_value = self.raw_data.get(name)
    if (new_value is not None):
        value = new_value
        container = self.raw_data
    matches = list(self._ResolveContext(context, name, self.raw_data))
    if matches:
        matches.sort(key=(lambda x: len(x[2])))
        value = matches[(-1)][1]
        container = matches[(-1)][0]
        if ((len(matches) >= 2) and (len(matches[(-1)][2]) == len(matches[(-2)][2])) and (matches[(-1)][2] != matches[(-2)][2]) and (matches[(-1)][1] != matches[(-2)][1])):
            logging.warn('Ambiguous    configuration    for    key    %s:    Contexts    of    equal    length:    %s    (%s)    and    %s    (%s)', name, matches[(-1)][2], matches[(-1)][1], matches[(-2)][2], matches[(-2)][1])
    if self.writeback_data:
        new_value = self.writeback_data.get(name)
        if (new_value is not None):
            value = new_value
            container = self.writeback_data
    if (name in self.global_override):
        return (self.global_override, self.global_override[name])
    return (container, value)
