docs: def parse_stack_refs(stack_references: List[str]) -> List[str]:
      '''
      Check if items included in `stack_references` are Senza definition
      file paths or stack name reference. If Senza definition file path,
      substitute the definition file path by the stack name in the same
      position on the list.
      '''
      stack_names = []
      references = list(stack_references)
      references.reverse()
      while references:
          current = references.pop()
          # current that might be a file
          file_path = os.path.abspath(current)
          if os.path.exists(file_path) and os.path.isfile(file_path):
              try:
                  with open(file_path) as fd:
                      data = yaml.safe_load(fd)
                  current = data['SenzaInfo']['StackName']
              except (KeyError, TypeError, YAMLError):
                  raise click.UsageError(
                      'Invalid senza definition {}'.format(current)
                  )
          stack_names.append(current)
      return stack_names