class_docstr: In NLTK, a ``ComplexType`` is a function.  These functions are curried, so if you need multiple
  arguments for your function you nest ``ComplexTypes``.  That currying makes things difficult
  for us, and we mitigate the problems by adding ``return_type`` and ``argument_type`` functions
  to ``ComplexType``.
class_docstr_tok: ["In","NLTK",",","a","``","ComplexType","``","is","a","function",".","These","functions","are","curried",",","so","if","you","need","multiple","arguments","for","your","function","you","nest","``","ComplexTypes","``",".","That","currying","makes","things","difficult","for","us",",","and","we","mitigate","the","problems","by","adding","``","return_type","``","and","``","argument_type","``","functions","to","``","ComplexType","``","."]
docstr: Takes a set of ``BasicTypes`` and replaces any instances of ``ANY_TYPE`` inside this
  complex type with each of those basic types.
code: def substitute_any_type(self, basic_types):
      """
      Takes a set of ``BasicTypes`` and replaces any instances of ``ANY_TYPE`` inside this
      complex type with each of those basic types.
      """
      substitutions = []
      for first_type in substitute_any_type(self.first, basic_types):
          for second_type in substitute_any_type(
              self.second, basic_types
          ):
              substitutions.append(
                  self.__class__(first_type, second_type)
              )
      return substitutions
  
imports: from __future__ import absolute_import
  from collections import defaultdict
  from nltk.sem.logic import Expression, ApplicationExpression, ConstantExpression, LogicParser, Variable
  from nltk.sem.logic import Type, BasicType, ComplexType, ANY_TYPE
  from allennlp.common.util import START_SYMBOL
label_desc: Use image node_id 3 for calling the ComplexType obj's underlying member method code with example usage: obj.substitute_any_type(basic_types) and returns: substitutions