<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def name_to_config(template):
 """Read template file into a dictionary to use as base for all samples. Handles well-known template names, pulled from GitHub repository and local files. """

    if objectstore.is_remote(template):
        with objectstore.open_file(template) as in_handle:
            config = yaml.safe_load(in_handle)
        with objectstore.open_file(template) as in_handle:
            txt_config = in_handle.read()
    elif os.path.isfile(template):
        if template.endswith(".csv"):
            raise ValueError("Expected YAML file for template and found CSV, are arguments switched? %s" % template)
        with open(template) as in_handle:
            txt_config = in_handle.read()
        with open(template) as in_handle:
            config = yaml.safe_load(in_handle)
    else:
        base_url = "https://raw.github.com/bcbio/bcbio-nextgen/master/config/templates/%s.yaml"
        try:
            with contextlib.closing(urllib.request.urlopen(base_url % template)) as in_handle:
                txt_config = in_handle.read().decode()
            with contextlib.closing(urllib.request.urlopen(base_url % template)) as in_handle:
                config = yaml.safe_load(in_handle)
        except (urllib.error.HTTPError, urllib.error.URLError):
            raise ValueError("Could not find template '%s' locally or in standard templates on GitHub"
                             % template)
    return config, txt_config