def get_arch(arch):
    "Try to return an architecture instance.\n\n    Args:\n        arch: can be a string in the form of arch:option1:option2\n\n    .. doctest::\n\n        >>> from ppci.api import get_arch\n        >>> arch = get_arch('msp430')\n        >>> arch\n        msp430-arch\n        >>> type(arch)\n        <class 'ppci.arch.msp430.arch.Msp430Arch'>\n    "
    if isinstance(arch, Architecture):
        return arch
    elif isinstance(arch, str):
        from .target_list import create_arch
        if (':' in arch):
            parts = arch.split(':')
            return create_arch(parts[0], options=tuple(parts[1:]))
        else:
            return create_arch(arch)
    raise ValueError('Invalid architecture {}'.format(arch))
Try to return an architecture instance.

Args:
    arch: can be a string in the form of arch:option1:option2

.. doctest::

    >>> from ppci.api import get_arch
    >>> arch = get_arch('msp430')
    >>> arch
    msp430-arch
    >>> type(arch)
    <class 'ppci.arch.msp430.arch.Msp430Arch'>
def get_arch(arch):
    "Try to return an architecture instance.\n\n    Args:\n        arch: can be a string in the form of arch:option1:option2\n\n    .. doctest::\n\n        >>> from ppci.api import get_arch\n        >>> arch = get_arch('msp430')\n        >>> arch\n        msp430-arch\n        >>> type(arch)\n        <class 'ppci.arch.msp430.arch.Msp430Arch'>\n    "
    if isinstance(arch, Architecture):
        return arch
    elif isinstance(arch, str):
        from .target_list import create_arch
        if (':' in arch):
            parts = arch.split(':')
            return create_arch(parts[0], options=tuple(parts[1:]))
        else:
            return create_arch(arch)
    raise ValueError('Invalid architecture {}'.format(arch))