code: def trim(*, docstring):
      """Trim function from PEP-257."""
      if not docstring:
          return ""
      # Convert tabs to spaces (following the normal Python rules)
      # and split into a list of lines:
      lines = docstring.expandtabs().splitlines()
      # Determine minimum indentation (first line doesn't count):
      indent = sys.maxsize
      for line in lines[1:]:
          stripped = line.lstrip()
          if stripped:
              indent = min(indent, len(line) - len(stripped))
      # Remove indentation (first line is special):
      trimmed = [lines[0].strip()]
      if indent < sys.maxsize:
          for line in lines[1:]:
              trimmed.append(line[indent:].rstrip())
      # Strip off trailing and leading blank lines:
      while trimmed and not trimmed[-1]:
          trimmed.pop()
      while trimmed and not trimmed[0]:
          trimmed.pop(0)
  
      # Current code/unittests expects a line return at
      # end of multiline docstrings
      # workaround expected behavior from unittests
      if "\n" in docstring:
          trimmed.append("")
  
      return "\n".join(trimmed)
  
file_path: ivy/ivy_tests/test_docstrings.py
imports: import warnings
  import re
  from contextlib import redirect_stdout
  from io import StringIO
  import numpy
  import sys
  import pytest
  import ivy
  import ivy_tests.test_ivy.helpers
label_desc: Use image node_id 1 for calling a global function with example usage: trim() and returns: str, str