Find maximum area of island in matrix
Some suggestions:


Nested functions are unusual; typically they would be neighbour functions instead. This ensures that all the context that each function needs is passed to it, making it easier to grasp the entire context involved in the processing in each function.
Python 3 supports type annotations, which are a more explicit way of declaring input and output types. You can check that your code is properly annotated using mypy, for example with this rather strict configuration:

[mypy]
check_untyped_defs = true
disallow_untyped_defs = true
ignore_missing_imports = true
no_implicit_optional = true
warn_redundant_casts = true
warn_return_any = true
warn_unused_ignores = true

Longer variable names can make your code more readable. For example, I can't tell what q is without reading most of the code, and even then it might be unclear, especially since it's an "intermediate" variable (neither a parameter nor a return value).
You could use a set of constants to define the directions in a more human readable form such as DIRECTION_WEST = (-1, 0).
Inlining such as if foo: continue is generally frowned upon, since it makes it harder to skim the code vertically.
Your docstring could include a definition of the problem, possibly by simply copying from the LeetCode website.
Python has exceptions, and it's recommended to use them rather than special return values to signal a problem.