code: def _resolve_references(templates):
      
  
      def repl(match):
          lib.echo("Deprecation warning: The {@ref} syntax is being removed")
          key = pattern[match.start():match.end()].strip("@{}")
          if key not in templates:
              sys.stderr.write("Unresolvable reference: \"%s\"" % key)
              sys.exit(lib.USER_ERROR)
          return templates[key]
  
      for key, pattern in templates.copy().iteritems():
          templates[key] = re.sub("{@\w+}", repl, pattern)
  
      return templates
docs: Resolve {@} occurences by expansion
  
      Given a dictionary {"a": "{@b}/x", "b": "{key}/y"}
      Return {"a", "{key}/y/x", "b": "{key}/y"}
  
      {
          key: {@reference}/{variable} # pattern
      }
  
      In plain english, it looks within `pattern` for
      references and replaces them with the value of the
      matching key.
  
      {
          root: {cwd}/{project}
          item: {@root}/{item}
      }
  
      In the above case, `item` is referencing `root` which
      is resolved into this.
  
      {
          item: {cwd}/{project}/{item}
      }
  
      Example:
          >>> templates = {"a": "{@b}/x", "b": "{key}/y"}
          >>> resolved = _resolve_references(templates)
          >>> assert resolved["a"] == "{key}/y/x"