def create_vm_replicas(coriolis, source_endpoint, destination_endpoint,
                       source_options, destination_options, network_map,
                       storage_mappings, vms, separate_replica_per_vm=False):
    """ Creates Replica(s) for the given VMs with the provided parameters.

    :param source/destination_endpoint: endpoint names or IDs
    :param source/destination_options: extra options relating to source/target
    :param network_map: mapping between source and target networks
    :param storage_mappings: mappings for storage
    :param vms: list of source VM names/indentifiers
    :param separate_replica_per_vm: whether or not to create separate Replica
    for each VM. This is useful for more granular transfers.
    """
    replicas = []
    vm_groupings = [vms]
    if separate_replica_per_vm:
        vm_groupings = [[vm] for vm in vms]

    existing_source_vms = [
        (vm.id, vm.instance_name)
        for vm in coriolis.endpoint_instances.list(
            source_endpoint, env=source_options)]

    for vm_group in vm_groupings:
        for vm_name_or_id in vm_group:
            matches = [
                ex for ex in existing_source_vms
                if vm_name_or_id in ex]
            if not matches:
                raise Exception(
                    "Could not find source VM '%s' on source endpoint '%s'" % (
                        vm_name_or_id, source_endpoint))


        print("Creating Replica for VM(s): %s" % vm_group)
        replicas.append(
            coriolis.replicas.create(
                source_endpoint, destination_endpoint,
                source_options, destination_options,
                vm_group,
                network_map=network_map,
                storage_mappings=storage_mappings))

    return replicas