code: def TrimBeginningAndEndingSlashes(path):
      
      if path.startswith('/'):
          # Returns substring starting from index 1 to end of the string
          path = path[1:]
  
      if path.endswith('/'):
          # Returns substring starting from beginning to last but one char in the string
          path = path[:-1]
  
      return path
docs: Trims beginning and ending slashes
  
      :param str path:
  
      :return:
          Path with beginning and ending slashes trimmed.
      :rtype: str