Take a requested index and the maximum size of the item container.
Check if the index is valid and return an error if it is.
The purpose of this function is to enable handling of out of bounds without triggering a panic.
Also, add negative indices like Python does when doing a reverse search!