'Target binary architecture.
Allowed values are listed in :attr:`pwnlib.context.ContextType.architectures`.
Side Effects:
If an architecture is specified which also implies additional
attributes (e.g. \'amd64\' implies 64-bit words, \'powerpc\' implies
big-endian), these attributes will be set on the context if a
user has not already set a value.
The following properties may be modified.
- :attr:`bits`
- :attr:`endian`
Raises:
AttributeError: An invalid architecture was specified
Examples:
>>> context.clear()
>>> context.arch == \'i386\' # Default architecture
True
>>> context.arch = \'mips\'
>>> context.arch == \'mips\'
True
>>> context.arch = \'doge\' #doctest: +ELLIPSIS
Traceback (most recent call last):
AttributeError: arch must be one of [\'aarch64\', ..., \'thumb\']
>>> context.arch = \'ppc\'
>>> context.arch == \'powerpc\' # Aliased architecture
True
>>> context.clear()
>>> context.bits == 32 # Default value
True
>>> context.arch = \'amd64\'
>>> context.bits == 64 # New value
True
Note that expressly setting :attr:`bits` means that we use
that value instead of the default
>>> context.clear()
>>> context.bits = 32
>>> context.arch = \'amd64\'
>>> context.bits == 32
True
Setting the architecture can override the defaults for
both :attr:`endian` and :attr:`bits`
>>> context.clear()
>>> context.arch = \'powerpc64\'
>>> vars(context) == {\'arch\': \'powerpc64\', \'bits\': 64, \'endian\': \'big\'}
True'

@_validator
def arch(self, arch):

    arch = arch.lower()
    transform = [('ppc64', 'powerpc64'), ('ppc', 'powerpc'), ('x86_64', 'amd64'), ('x86', 'i386'), ('i686', 'i386'), ('armeabi', 'arm'), ('arm64', 'aarch64')]
    for (k, v) in transform:
        if arch.startswith(k):
            arch = v
            break
    try:
        defaults = ContextType.architectures[arch]
    except KeyError:
        raise AttributeError(('AttributeError:    arch    must    be    one    of    %r' % sorted(ContextType.architectures)))
    for (k, v) in ContextType.architectures[arch].items():
        if (k not in self._tls):
            self._tls[k] = v
    return arch
