@staticmethod
def _value_for_target(value, target):
    """ If a value is valid for a particular target architecture then
        return the value, otherwise return None.
        """
    parts = value.split('#', maxsplit=1)
    if len(parts) != 2:
        return value
    scope, value = parts
    for name in scope.replace(' ', '').split('|'):
        if name.startswith('!'):
            negate = True
            name = name[1:]
        else:
            negate = False
        if '-' in name:
            matches = target.name == name
        else:
            matches = target.platform.name == name
        if negate:
            matches = not matches
        if matches:
            return value
    return None
