'Expands variables references in ARCHS, and filter by VALID_ARCHS if it
is defined (if not set, Xcode accept any value in ARCHS, otherwise, only
values present in VALID_ARCHS are kept).'

def ActiveArchs(self, archs, valid_archs, sdkroot):

    expanded_archs = self._ExpandArchs((archs or self._default), (sdkroot or ''))
    if valid_archs:
        filtered_archs = []
        for arch in expanded_archs:
            if (arch in valid_archs):
                filtered_archs.append(arch)
        expanded_archs = filtered_archs
    return expanded_archs
