<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def createResourceMapFromStream(in_stream, base_url=d1_common.const.URL_DATAONE_ROOT):
 """Create a simple OAI-ORE Resource Map with one Science Metadata document and any number of Science Data objects, using a stream of PIDs. Args: in_stream: The first non-blank line is the PID of the resource map itself. Second line is the science metadata PID and remaining lines are science data PIDs. Example stream contents: :: PID_ORE_value sci_meta_pid_value data_pid_1 data_pid_2 data_pid_3 base_url : str Root of the DataONE environment in which the Resource Map will be used. Returns: ResourceMap : OAI-ORE Resource Map """

    pids = []
    for line in in_stream:
        pid = line.strip()
        if pid == "#" or pid.startswith("# "):
            continue

    if len(pids) < 2:
        raise ValueError("Insufficient numbers of identifiers provided.")

    logging.info("Read {} identifiers".format(len(pids)))
    ore = ResourceMap(base_url=base_url)
    logging.info("ORE PID = {}".format(pids[0]))
    ore.initialize(pids[0])
    logging.info("Metadata PID = {}".format(pids[1]))
    ore.addMetadataDocument(pids[1])
    ore.addDataDocuments(pids[2:], pids[1])

    return ore