<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate_uncles(state, block):
 """Validate the uncles of this block."""

    # Make sure hash matches up
    if utils.sha3(rlp.encode(block.uncles)) != block.header.uncles_hash:
        raise VerificationFailed("Uncle hash mismatch")
    # Enforce maximum number of uncles
    if len(block.uncles) > state.config['MAX_UNCLES']:
        raise VerificationFailed("Too many uncles")
    # Uncle must have lower block number than blockj
    for uncle in block.uncles:
        if uncle.number >= block.header.number:
            raise VerificationFailed("Uncle number too high")

    # Check uncle validity
    MAX_UNCLE_DEPTH = state.config['MAX_UNCLE_DEPTH']
    ancestor_chain = [block.header] + \
        [a for a in state.prev_headers[:MAX_UNCLE_DEPTH + 1] if a]
    # Uncles of this block cannot be direct ancestors and cannot also
    # be uncles included 1-6 blocks ago
    ineligible = [b.hash for b in ancestor_chain]
    for blknum, uncles in state.recent_uncles.items():
        if state.block_number > int(
                blknum) >= state.block_number - MAX_UNCLE_DEPTH:
            ineligible.extend([u for u in uncles])
    eligible_ancestor_hashes = [x.hash for x in ancestor_chain[2:]]
    for uncle in block.uncles:
        if uncle.prevhash not in eligible_ancestor_hashes:
            raise VerificationFailed("Uncle does not have a valid ancestor")
        parent = [x for x in ancestor_chain if x.hash == uncle.prevhash][0]
        if uncle.difficulty != calc_difficulty(
                parent, uncle.timestamp, config=state.config):
            raise VerificationFailed("Difficulty mismatch")
        if uncle.number != parent.number + 1:
            raise VerificationFailed("Number mismatch")
        if uncle.timestamp < parent.timestamp:
            raise VerificationFailed("Timestamp mismatch")
        if uncle.hash in ineligible:
            raise VerificationFailed("Duplicate uncle")
        if uncle.gas_used > uncle.gas_limit:
            raise VerificationFailed("Uncle used too much gas")
        if not check_pow(state, uncle):
            raise VerificationFailed('uncle pow mismatch')
        ineligible.append(uncle.hash)
    return True