'Creates an `HDUList` instance from a string or other in-memory data
buffer containing an entire FITS file.  Similar to
:meth:`HDUList.fromfile`, but does not accept the mode or memmap
arguments, as they are only relevant to reading from a file on disk.
This is useful for interfacing with other libraries such as CFITSIO,
and may also be useful for streaming applications.
Parameters
data : str, buffer, memoryview, etc.
A string or other memory buffer containing an entire FITS file.  It
should be noted that if that memory is read-only (such as a Python
string) the returned :class:`HDUList`\'s data portions will also be
read-only.
kwargs : dict
Optional keyword arguments.  See
:func:`astropy.io.fits.open` for details.
Returns
hdul : HDUList
An :class:`HDUList` object representing the in-memory FITS file.'

@classmethod
def fromstring(cls, data, **kwargs):

    try:
        np.ndarray((), dtype='ubyte', buffer=data)
    except TypeError:
        raise TypeError('The    provided    object    {}    does    not    contain    an    underlying    memory    buffer.        fromstring()    requires    an    object    that    supports    the    buffer    interface    such    as    bytes,    str    (in    Python    2.x    but    not    in    3.x),    buffer,    memoryview,    ndarray,    etc.        This    restriction    is    to    ensure    that    efficient    access    to    the    array/table    data    is    possible.'.format(data))
    return cls._readfrom(data=data, **kwargs)
