def _search_in_bases(type_):
    """Implementation detail."""
    found = False
    for base_type in type_.declaration.bases:
        try:
            found = internal_type_traits.get_by_name(
                base_type.related_class, "element_type")
        except runtime_errors.declaration_not_found_t:
            pass
        if found:
            return found
    raise RuntimeError(
        ("Unable to find 'element_type' declaration '%s'"
         "in type '%s'.") % type_.decl_string)