def brackets_whitespace(input)
      output = input.gsub(/([\(\[\{])\s*/, '\1')
      output = output.gsub(/\s*([\]\)\}])/, '\1')
      output = output.gsub(/\s+([\(\[\{])\s*/, ' \1')
      output = output.gsub(/\s*([\]\)\}])\s+/, '\1 ')
    end
def brackets_whitespace(input)
      output = input.gsub(/([\(\[\{])\s*/, '\1')
      output = output.gsub(/\s*([\]\)\}])/, '\1')
      output = output.gsub(/\s+([\(\[\{])\s*/, ' \1')
      output = output.gsub(/\s*([\]\)\}])\s+/, '\1 ')
    end
Fixes spaces around various brackets.

 @param input [String] The paragraph which will be converted.
 @return [String] Paragraph with correct spaces around brackets.