from typing import Any
from typing import Optional
import inspect


def typeof(obj: Any) -> Optional[str]:
  """Get the definition of the given `obj`.

  Parameters:

  - `obj`: The python object to find its definition.

  Returns:

  - `class ` if class.
  - `def ` if function.
  - `async def ` if async function.
  - `property ` if defined with `@property`.
  - `None` otherwise.
  """
  type_: Optional[str] = None
  if inspect.isclass(obj):
    type_ = 'class '
  elif inspect.iscoroutinefunction(obj):
    type_ = 'async def '
  elif inspect.ismethod(obj) or inspect.isfunction(obj):
    type_ = 'def '
  elif isinstance(obj, property):
    type_ = 'property '
  return type_