<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_organizations_parser(stream):
 """Create an organizations parser for the given stream. Factory function that creates an organizations parser for the given stream. The stream is only used to guess the type of the required parser. :param stream: stream used to guess the type of the parser :returns: an organizations parser :raise InvalidFormatError: raised when no one of the available parsers can parse the given stream """

    import sortinghat.parsing as parsing

    # First, try with default parser
    for p in parsing.SORTINGHAT_ORGS_PARSERS:
        klass = parsing.SORTINGHAT_ORGS_PARSERS[p]

        parser = klass()

        if parser.check(stream):
            return parser
    raise InvalidFormatError(cause=INVALID_FORMAT_MSG)