<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate_indices(indices, n):
 """ Perform bounds-checking for an indexer. -1 is allowed for indicating missing values. Parameters indices : ndarray n : int length of the array being indexed Raises ------ ValueError Examples -------- # OK ValueError IndexError # OK IndexError """

    if len(indices):
        min_idx = indices.min()
        if min_idx < -1:
            msg = ("'indices' contains values less than allowed ({} < {})"
                   .format(min_idx, -1))
            raise ValueError(msg)

        max_idx = indices.max()
        if max_idx >= n:
            raise IndexError("indices are out-of-bounds")