from typing import Any


def format_heading(name: str, parent: Any) -> str:
  """Get the h2 or h3 markdown formatted heading.

  Parameters:

  - `name`: The name of heading.

  - `parent`: The parent python object to check
    if `name` exists in parent's attributes.

  Returns:

  - h2 or h3 markdown formatted text.
  """
  if getattr(parent, name, None) is not None:
    return f'### `{name}`'
  return f'## `{name}`'