code: def speed(
      audio: Union[str, np.ndarray],
      sample_rate: int = DEFAULT_SAMPLE_RATE,
      factor: float = 2.0,
      output_path: Optional[str] = None,
      metadata: Optional[List[Dict[str, Any]]] = None,
  ) -> Tuple[np.ndarray, int]:
      """
      Changes the speed of the audio, affecting pitch as well
  
      @param audio: the path to the audio or a variable of type np.ndarray that
          will be augmented
  
      @param sample_rate: the audio sample rate of the inputted audio
  
      @param factor: the speed factor. If rate > 1 the audio will be sped up by that
          factor; if rate < 1 the audio will be slowed down by that factor
  
      @param output_path: the path in which the resulting audio will be stored. If None,
          the resulting np.ndarray will still be returned
  
      @param metadata: if set to be a list, metadata about the function execution
          including its name, the source & dest duration, sample rates, etc. will be
          appended to the inputted list. If set to None, no metadata will be appended
  
      @returns: the augmented audio array and sample rate
      """
      assert (
          isinstance(factor, (int, float)) and factor > 0
      ), "Expected 'factor' to be a positive number"
      audio, sample_rate = audutils.validate_and_load_audio(
          audio, sample_rate
      )
  
      out_sample_rate = int(sample_rate * factor)
      audutils.get_metadata(
          metadata=metadata,
          function_name="speed",
          audio=audio,
          sample_rate=sample_rate,
          dst_audio=audio,
          dst_sample_rate=out_sample_rate,
          output_path=output_path,
          factor=factor,
      )
  
      return audutils.ret_and_save_audio(
          audio, output_path, out_sample_rate
      )
  
imports: from copy import deepcopy
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from augly.audio import utils
  from augly.utils import DEFAULT_SAMPLE_RATE
  from augly.utils.libsndfile import install_libsndfile
  import librosa
  from torchaudio import sox_effects
  from torchaudio.functional import fftconvolve, resample
label_desc: Use image node_id 17 for calling a global function with example usage: speed(audio, sample_rate, factor, output_path, metadata) and returns: audutils