Return True if text is the beginning of the function definition.

def is_start_of_function(text):
    """Return True if text is the beginning of the function definition."""
    if isinstance(text, str) or isinstance(text, unicode):
        function_prefix = ['def', 'async def']
        text = text.lstrip()

        for prefix in function_prefix:
            if text.startswith(prefix):
                return True

    return False