def _create_array_of_type(t):
    """Returns an array to contain objects of type t."""
    if t in _array_types:
        return _array_types[t]()

    array_type_name = 'ArrayOf%s' % t
    array_type = type(array_type_name, (DataObject,), {})

    def __init__(self):
        super(array_type, self).__init__(array_type_name)
        setattr(self, t, [])

    setattr(array_type, '__init__', __init__)

    _array_types[t] = array_type
    return array_type()
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/virt/vmwareapi/fake.py/_create_array_of_type/original