def allocate(shape, dtype='u4', target=None, **kwargs):
    """Allocate a PYNQ buffer

    This API mimics the numpy ndarray constructor with the following
    differences:

     * The default dtype is 32-bit unsigned int rather than float
     * A new ``target`` keyword parameter to determine where the
       buffer should be allocated

    The target determines where the buffer gets allocated

     * If None then the currently active device is used
     * If a Device is specified then the main memory

    """
    from .pl_server import Device
    if target is None:
        target = Device.active_device
    return target.allocate(shape, dtype, **kwargs)
