<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def read_h5ad(filename, backed: Optional[str] = None, chunk_size: int = 6000):
 """Read ``.h5ad``-formatted hdf5 file. Parameters filename File name of data file. backed : {``None``, ``'r'``, ``'r+'``} If ``'r'``, load :class:`~anndata.AnnData` in ``backed`` mode instead of fully loading it into memory (`memory` mode). If you want to modify backed attributes of the AnnData object, you need to choose ``'r+'``. chunk_size Used only when loading sparse dataset that is stored as dense. Loading iterates through chunks of the dataset of this row size until it reads the whole dataset. Higher size means higher memory consumption and higher loading speed. """

    if isinstance(backed, bool):
        # We pass `None`s through to h5py.File, and its default is “a”
        # (=“r+”, but create the file if it doesn’t exist)
        backed = 'r+' if backed else None
        warnings.warn(
            "In a future version, read_h5ad will no longer explicitly support "
            "boolean arguments. Specify the read mode, or leave `backed=None`.",
            DeprecationWarning,
        )
    if backed:
        # open in backed-mode
        return AnnData(filename=filename, filemode=backed)
    else:
        # load everything into memory
        constructor_args = _read_args_from_h5ad(filename=filename, chunk_size=chunk_size)
        X = constructor_args[0]
        dtype = None
        if X is not None:
            dtype = X.dtype.name  # maintain dtype, since 0.7
        return AnnData(*_read_args_from_h5ad(filename=filename, chunk_size=chunk_size), dtype=dtype)