<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def slice(index, template):
 """Slice a template based on it's positional argument Arguments: index (int):
 Position at which to slice template (str):
 Template to slice Example: '{cwd}/{0}' '{cwd}/{0}/assets/{1}' """


    try:
        return re.match("^.*{[%i]}" % index, template).group()
    except AttributeError:
        raise ValueError("Index %i not found in template: %s"
                         % (index, template))