<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check(state_engine, nameop, block_id, checked_ops ):
 """ Verify the validity of an update to a name's associated data. Use the nameop's 128-bit name hash to find the name itself. NAME_UPDATE isn't allowed during an import, so the name's namespace must be ready. Return True if accepted Return False if not. """


    name_consensus_hash = nameop['name_consensus_hash']
    sender = nameop['sender']

    # deny updates if we exceed quota--the only legal operations are to revoke or transfer.
    sender_names = state_engine.get_names_owned_by_sender( sender )
    if len(sender_names) > MAX_NAMES_PER_SENDER:
        log.warning("Sender '%s' has exceeded quota: only transfers or revokes are allowed" % (sender))
        return False

    name, consensus_hash = state_engine.get_name_from_name_consensus_hash( name_consensus_hash, sender, block_id )

    # name must exist
    if name is None or consensus_hash is None:
        log.warning("Unable to resolve name consensus hash '%s' to a name owned by '%s'" % (name_consensus_hash, sender))
        # nothing to do--write is stale or on a fork
        return False

    namespace_id = get_namespace_from_name( name )
    name_rec = state_engine.get_name( name )

    if name_rec is None:
        log.warning("Name '%s' does not exist" % name)
        return False

    # namespace must be ready
    if not state_engine.is_namespace_ready( namespace_id ):
        # non-existent namespace
        log.warning("Namespace '%s' is not ready" % (namespace_id))
        return False

    # name must not be revoked
    if state_engine.is_name_revoked( name ):
        log.warning("Name '%s' is revoked" % name)
        return False

    # name must not be expired as of the *last block processed*
    if state_engine.is_name_expired( name, state_engine.lastblock ):
        log.warning("Name '%s' is expired" % name)
        return False

    # name must not be in grace period in *this* block 
    if state_engine.is_name_in_grace_period(name, block_id):
        log.warning("Name '{}' is in the renewal grace period.  It can only be renewed at this time.".format(name))
        return False

    # the name must be registered
    if not state_engine.is_name_registered( name ):
        # doesn't exist
        log.warning("Name '%s' is not registered" % name )
        return False

    # the name must be owned by the same person who sent this nameop
    if not state_engine.is_name_owner( name, sender ):
        # wrong owner
        log.warning("Name '%s' is not owned by '%s'" % (name, sender))
        return False

    # remember the name and consensus hash, so we don't have to re-calculate it...
    nameop['name'] = name
    nameop['consensus_hash'] = consensus_hash
    nameop['sender_pubkey'] = name_rec['sender_pubkey']

    # not stored, but re-calculateable
    del nameop['name_consensus_hash']

    return True