<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cast_scalar_indexer(val):
 """ To avoid numpy DeprecationWarnings, cast float to integer where valid. Parameters val : scalar Returns ------- outval : scalar """

    # assumes lib.is_scalar(val)
    if lib.is_float(val) and val == int(val):
        return int(val)
    return val