def getFork(user, upstream, create=False):
  """Get user's fork of the specified repository.

  :param user:
    Github user or organization which owns the requested fork.
  :type user:
    :class:`github:github.NamedUser.NamedUser`,
    :class:`github:github.AuthenticatedUser.AuthenticatedUser` or
    :class:`github:github.Organization.Organization`
  :param upstream:
    Upstream repository of the requested fork.
  :type upstream:
    :class:`github:github.Repository.Repository`
  :param create:
    If ``True``, create the forked repository if no such fork exists.
  :type create:
    :class:`bool`

  :return:
    The specified fork repository, or ``None`` if no such fork exists and
    ``create`` is ``False``.
  :rtype:
    :class:`github:github.Repository.Repository` or ``None``.

  :raises:
    :class:`github:github.GithubException.GithubException` if ``user`` does not
    have permission to create a repository.

  This function attempts to look up a repository owned by the specified user or
  organization which is a fork of the specified upstream repository, optionally
  creating one if it does not exist:

  .. code-block:: python

    # Create session
    session = GithubHelper.logIn()

    # Get user
    user = session.get_user("jdoe")

    # Get upstream repository
    upstream = GithubHelper.getRepo(session, 'octocat/Spoon-Knife')

    # Look up fork
    fork = GithubHelper.getFork(user=user, upstream=upstream)
  """

  for repo in user.get_repos():
    if repo.fork and repo.parent.url == upstream.url:
      return repo

  if create:
    return user.create_fork(upstream)

  return None