def parse_func(stmt, body):
    """Return (name, signature) for the given function definition."""
    header, _, end = stmt.partition(body)
    assert end.strip() == '}'
    assert header.strip().endswith('{')
    header, _, _= header.rpartition('{')

    signature = ' '.join(header.strip().splitlines())

    _, _, name = signature.split('(')[0].strip().rpartition(' ')
    assert name

    return name, signature