There is nothing as disruptive to code comprehensibility than excessive nesting. Every nest in the code makes it harder to keep track of the current state. A very simple trick exists to identify problem code, you just have to make sure it does not look like an arrow. When you identify arrows (probably at the second level of nesting), you should refactor it as soon as possible.

Consider the following python code:

if condition1:
    if condition2:
        if condition3:
            # Code block
        else:
            # Code block
    else:
        # Code block
else:
    # Code block

The code looks like the head of an arrow. Especially the else blocks are hard to read and reason about in the example. It will take a while to figure out the condition needed to enter for example the third else. This is usually made more difficult by also having to consider the actual code instead of the simplified code blocks in the example.

The code can be easily improved using guards. Guards work by using early return to simplify the flow.

if not condition1:
    # Code block
    return

if not condition2:
    # Code block
    return

if not condition3:
    # Code block
    return

# Code block

This flattened version of the code is much easier to read and understand. It avoids the unnecessary nesting and no longer looks like an arrow. By using this technique code can become much more readable.