This issue occurs when code is not indented but should be.

Anti-pattern

def print_list(my_list):
"""This should be indented"""
    print('Nope')

Best practice

Indent the docstring by four spaces.

def print_list(my_list):
    """This should be indented"""
    print('Nope')