from typing import Callable
import inspect
import re


def get_func_source(func: Callable) -> str:
    """
    Return the source code for a function.
    """
    source = inspect.getsource(func)

    # Try to trim away the decorators.
    lines = source.split("\n")
    for i, line in enumerate(lines):
        if re.match(r"^ *def ", line):
            return "\n".join(lines[i:])

    return source