code: def combsimp(expr):
      r"""
      Simplify combinatorial expressions.
  
      Explanation
      ===========
  
      This function takes as input an expression containing factorials,
      binomials, Pochhammer symbol and other "combinatorial" functions,
      and tries to minimize the number of those functions and reduce
      the size of their arguments.
  
      The algorithm works by rewriting all combinatorial functions as
      gamma functions and applying gammasimp() except simplification
      steps that may make an integer argument non-integer. See docstring
      of gammasimp for more information.
  
      Then it rewrites expression in terms of factorials and binomials by
      rewriting gammas as factorials and converting (a+b)!/a!b! into
      binomials.
  
      If expression has gamma functions or combinatorial functions
      with non-integer argument, it is automatically passed to gammasimp.
  
      Examples
      ========
  
      >>> from sympy.simplify import combsimp
      >>> from sympy import factorial, binomial, symbols
      >>> n, k = symbols('n k', integer = True)
  
      >>> combsimp(factorial(n)/factorial(n - 3))
      n*(n - 2)*(n - 1)
      >>> combsimp(binomial(n+1, k+1)/binomial(n, k))
      (n + 1)/(k + 1)
  
      """
  
      expr = expr.rewrite(gamma, piecewise=False)
      if any(
          isinstance(node, gamma) and not node.args[0].is_integer
          for node in preorder_traversal(expr)
      ):
          return gammasimp(expr)
  
      expr = _gammasimp(expr, as_comb=True)
      expr = _gamma_as_comb(expr)
      return expr
  
file_path: sympy/sympy/simplify/combsimp.py
imports: from sympy.core import Mul
  from sympy.core.function import count_ops
  from sympy.core.traversal import preorder_traversal, bottom_up
  from sympy.functions.combinatorial.factorials import binomial, factorial
  from sympy.functions import gamma
  from sympy.simplify.gammasimp import gammasimp, _gammasimp
  from sympy.utilities.timeutils import timethis
label_desc: Use image node_id 1 for calling a global function with example usage: combsimp(expr) and returns: expr, gammasimp