<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_name_preorder( self, name, sender_script_pubkey, register_addr, include_failed=False ):
 """ Get the current preorder for a name, given the name, the sender's script pubkey, and the registration address used to calculate the preorder hash. Return the preorder record on success. Return None if not found, or the preorder is already registered and not expired (even if revoked). NOTE: possibly returns an expired preorder (by design, so as to prevent someone from re-sending the same preorder with the same preorder hash). """

        # name registered and not expired?
        name_rec = self.get_name( name )
        if name_rec is not None and not include_failed:
            return None

        # what namespace are we in?
        namespace_id = get_namespace_from_name(name)
        namespace = self.get_namespace(namespace_id)
        if namespace is None:
            return None

        # isn't currently registered, or we don't care
        preorder_hash = hash_name(name, sender_script_pubkey, register_addr=register_addr)
        preorder = namedb_get_name_preorder( self.db, preorder_hash, self.lastblock )
        if preorder is None:
            # doesn't exist or expired
            return None

        # preorder must be younger than the namespace lifetime
        # (otherwise we get into weird conditions where someone can preorder
        # a name before someone else, and register it after it expires)
        namespace_lifetime_multiplier = get_epoch_namespace_lifetime_multiplier( self.lastblock, namespace_id )
        if preorder['block_number'] + (namespace['lifetime'] * namespace_lifetime_multiplier) <= self.lastblock:
            log.debug("Preorder is too old (accepted at {}, namespace lifetime is {}, current block is {})".format(preorder['block_number'], namespace['lifetime'] * namespace_lifetime_multiplier, self.lastblock))
            return None

        return preorder