'For each specialized type, try to coerce the object to a memoryview
slice of that type. This means obtaining a buffer and parsing the
format string.
TODO: separate buffer acquisition from format parsing'

def _buffer_parse_format_string_check(self, pyx_code, decl_code, specialized_type, env):

    dtype = specialized_type.dtype
    if specialized_type.is_buffer:
        axes = ([('direct', 'strided')] * specialized_type.ndim)
    else:
        axes = specialized_type.axes
    memslice_type = PyrexTypes.MemoryViewSliceType(dtype, axes)
    memslice_type.create_from_py_utility_code(env)
    pyx_code.context.update(coerce_from_py_func=memslice_type.from_py_function, dtype=dtype)
    decl_code.putln('{{memviewslice_cname}}    {{coerce_from_py_func}}(object)')
    pyx_code.context.update(specialized_type_name=specialized_type.specialization_string, sizeof_dtype=self._sizeof_dtype(dtype))
    pyx_code.put_chunk((u"\n                                                                #    try    {{dtype}}\n                                                                if    itemsize    ==    -1    or    itemsize    ==    {{sizeof_dtype}}:\n                                                                                memslice    =    {{coerce_from_py_func}}(arg)\n                                                                                if    memslice.memview:\n                                                                                                __PYX_XDEC_MEMVIEW(&memslice,    1)\n                                                                                                #    print    'found    a    match    for    the    buffer    through    format    parsing'\n                                                                                                %s\n                                                                                                break\n                                                                                else:\n                                                                                                __pyx_PyErr_Clear()\n                                                " % self.match))
