def METHOD_NAME(func):
    """Decorate a function to return a read-only array of ids.
    Parameters
    ----------
    func : function
        A function that returns a numpy array.
    Returns
    -------
    func
        A wrapped function that returns an id array.
    """
    @wraps(func)
    def _wrapped(self, *args, **kwds):
        """Create a function that returns an id array."""
        id_array = as_id_array(func(self, *args, **kwds))
        try:
            immutable_array = id_array.view()
            immutable_array.flags.writeable = False
        except ValueError:
            return id_array
        else:
            return immutable_array
    return _wrapped