<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_cas(key_options, global_options, item):
 """ Get the CAS from various inputs. This will properly honor the ``ignore_cas`` flag, if present. :param key_options: Key specific options :param global_options: Global options :param item: The item :return: The cas, or 0 if no cas """

    if item:
        ign_cas = get_option('ignore_cas', key_options, globals(), False)
        return 0 if ign_cas else item.cas
    else:
        try:
            cas = key_options['cas']
        except KeyError:
            try:
                cas = global_options['cas']
            except KeyError:
                return 0
        if not cas:
            return 0
        return cas