<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _TypecheckFunction(function, parent_type_check_dict, stack_location, self_name):
 """Decorator function to collect and execute type checks."""

  type_check_dict = _CollectTypeChecks(function, parent_type_check_dict,
                                      stack_location + 1, self_name)
  if not type_check_dict:
    return function

  def TypecheckWrapper(*args, **kwargs):
    arg_dict = _CollectArguments(function, args, kwargs)
    errors = _ValidateArguments(arg_dict, type_check_dict)
    if errors:
      raise TypeError("\n".join(errors))

    return_value = function(*args, **kwargs)

    errors = _ValidateReturnValue(return_value, type_check_dict)
    if errors:
      raise TypeError("\n".join(errors))
    return return_value

  TypecheckWrapper.__doc__ = function.__doc__
  TypecheckWrapper.__name__ = function.__name__
  TypecheckWrapper.type_check_dict = type_check_dict
  TypecheckWrapper.wrapped_function = function

  return TypecheckWrapper