<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_js_models(module, models, collection_prefix, model_prefix, model_fn, collection_fn, marker, integrate, js_file):
 # type: (str, str, str, str, str, str, str, bool, str) -> Union[str, None] """Generate models for Backbone Javascript applications. :param module: module from which models are imported :param models: model name, can be a tuple WineCountry/WineCountries as singular/plural :param model_prefix: namespace prefix for models (app.models.) :param collection_prefix: namespace prefix for collection (App.collections.) :param model_fn: name of model constructor (MyApp.bb.Model) :param collection_fn: name of collection constructor (MyApp.bb.Collection) :param marker: marker to indicate the auto generated code :param integrate: integrate to file :param js_file: file to integrate :return: generated models or nothing if writing into a file """


    options = {
        'model_prefix': model_prefix,
        'collection_prefix': collection_prefix,
        'model_fn': model_fn,
        'collection_fn': collection_fn
    }

    generator = ModelGenerator(module,
                               **{o: options[o] for o in options if options[o] is not None})

    models = generator.generate_models(parse_model_arg(models))

    if integrate:
        sys.stderr.write("Integrate is really experimental")

        if not marker:
            marker = hashlib.md5("{0}{1}".format(module, models)).hexdigest()

        start = "// * -- START AUTOGENERATED %s -- * //\n" % marker
        end = "// * -- END AUTOGENERATED %s -- * //\n" % marker

        return integrate_to_file("\n".join(models), js_file, start, end)

    else:
        return "\n".join(models)