import inspect
import ast
import textwrap


def ast_object(obj):
    """Convert a Python object to its AST representation."""
    src = inspect.getsource(obj)
    # ast wraps always into a module
    node = ast.parse(textwrap.dedent(src)).body[0]
    return node