We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Show pi in the text drawer as π
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues to confirm this idea does not exist. -->

### What is the expected enhancement?

Based on a discussion in #4931, there's interest in displaying pi in the text drawer as `π `instead of `pi`.
``` 
                   ┌─────────┐               ┌─────────┐
Change from   q_0: ┤ RX(pij) ├     to   q_0: ┤ RX(πj)  ├
                   └─────────┘               └─────────┘
```
To do this on all platforms requires completion of #4900 and modifying pi_check and 24 tests.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `qiskit/circuit/tools/pi_check.py`
Content:
```
1 # This code is part of Qiskit.
2 #
3 # (C) Copyright IBM 2017, 2019.
4 #
5 # This code is licensed under the Apache License, Version 2.0. You may
6 # obtain a copy of this license in the LICENSE.txt file in the root directory
7 # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
8 #
9 # Any modifications or derivative works of this code must retain this
10 # copyright notice, and modified files need to carry a notice indicating
11 # that they have been altered from the originals.
12 # pylint: disable=too-many-return-statements
13 
14 """Check if number close to values of PI
15 """
16 
17 import numpy as np
18 from qiskit.circuit.parameterexpression import ParameterExpression
19 from qiskit.exceptions import QiskitError
20 
21 MAX_FRAC = 16
22 N, D = np.meshgrid(np.arange(1, MAX_FRAC+1), np.arange(1, MAX_FRAC+1))
23 FRAC_MESH = N / D * np.pi
24 RECIP_MESH = N / D / np.pi
25 POW_LIST = np.pi ** np.arange(2, 5)
26 
27 
28 def pi_check(inpt, eps=1e-6, output='text', ndigits=5):
29     """ Computes if a number is close to an integer
30     fraction or multiple of PI and returns the
31     corresponding string.
32 
33     Args:
34         inpt (float): Number to check.
35         eps (float): EPS to check against.
36         output (str): Options are 'text' (default),
37                       'latex', 'mpl', and 'qasm'.
38         ndigits (int): Number of digits to print
39                        if returning raw inpt.
40 
41     Returns:
42         str: string representation of output.
43 
44     Raises:
45         QiskitError: if output is not a valid option.
46     """
47     if isinstance(inpt, ParameterExpression):
48         param_str = str(inpt)
49         syms = inpt._symbol_expr.expr_free_symbols
50         for sym in syms:
51             if not sym.is_number:
52                 continue
53             pi = pi_check(float(sym), eps=eps, output=output, ndigits=ndigits)
54             try:
55                 _ = float(pi)
56             except (ValueError, TypeError):
57                 # Strip leading '-' from pi since must replace with abs(sym)
58                 # in order to preserve spacing around minuses in expression
59                 if pi[0] == '-':
60                     pi = pi[1:]
61                 param_str = param_str.replace(str(abs(sym)), pi)
62         return param_str
63     elif isinstance(inpt, str):
64         return inpt
65 
66     def normalize(single_inpt):
67         if abs(single_inpt) < 1e-14:
68             return '0'
69 
70         if output in ['text', 'qasm']:
71             pi = 'pi'
72         elif output == 'latex':
73             pi = '\\pi'
74         elif output == 'mpl':
75             pi = '$\\pi$'
76         else:
77             raise QiskitError('pi_check parameter output should be text, '
78                               'latex, mpl, or qasm.')
79 
80         neg_str = '-' if single_inpt < 0 else ''
81 
82         # First check is for whole multiples of pi
83         val = single_inpt / np.pi
84         if abs(val) >= 1 - eps:
85             if abs(abs(val) - abs(round(val))) < eps:
86                 val = int(abs(round(val)))
87                 if abs(val) == 1:
88                     str_out = '{}{}'.format(neg_str, pi)
89                 else:
90                     if output == 'qasm':
91                         str_out = '{}{}*{}'.format(neg_str, val, pi)
92                     else:
93                         str_out = '{}{}{}'.format(neg_str, val, pi)
94                 return str_out
95 
96         # Second is a check for powers of pi
97         if abs(single_inpt) > np.pi:
98             power = np.where(abs(abs(single_inpt) - POW_LIST) < eps)
99             if power[0].shape[0]:
100                 if output == 'qasm':
101                     str_out = '{:.{}g}'.format(single_inpt, ndigits)
102                 elif output == 'latex':
103                     str_out = '{}{}^{}'.format(neg_str, pi, power[0][0] + 2)
104                 elif output == 'mpl':
105                     str_out = '{}{}$^{}$'.format(neg_str, pi, power[0][0] + 2)
106                 else:
107                     str_out = '{}{}**{}'.format(neg_str, pi, power[0][0] + 2)
108                 return str_out
109 
110         # Third is a check for a number larger than MAX_FRAC * pi, not a
111         # multiple or power of pi, since no fractions will exceed MAX_FRAC * pi
112         if abs(single_inpt) >= (MAX_FRAC * np.pi):
113             str_out = '{:.{}g}'.format(single_inpt, ndigits)
114             return str_out
115 
116         # Fourth check is for fractions for 1*pi in the numer and any
117         # number in the denom.
118         val = np.pi / single_inpt
119         if abs(abs(val) - abs(round(val))) < eps:
120             val = int(abs(round(val)))
121             if output == 'latex':
122                 str_out = '\\frac{%s%s}{%s}' % (neg_str, pi, val)
123             else:
124                 str_out = '{}{}/{}'.format(neg_str, pi, val)
125             return str_out
126 
127         # Fifth check is for fractions where the numer > 1*pi and numer
128         # is up to MAX_FRAC*pi and denom is up to MAX_FRAC and all
129         # fractions are reduced. Ex. 15pi/16, 2pi/5, 15pi/2, 16pi/9.
130         frac = np.where(np.abs(abs(single_inpt) - FRAC_MESH) < eps)
131         if frac[0].shape[0]:
132             numer = int(frac[1][0]) + 1
133             denom = int(frac[0][0]) + 1
134             if output == 'latex':
135                 str_out = '\\frac{%s%s%s}{%s}' % (neg_str, numer, pi, denom)
136             elif output == 'qasm':
137                 str_out = '{}{}*{}/{}'.format(neg_str, numer, pi, denom)
138             else:
139                 str_out = '{}{}{}/{}'.format(neg_str, numer, pi, denom)
140             return str_out
141 
142         # Sixth check is for fractions where the numer > 1 and numer
143         # is up to MAX_FRAC and denom is up to MAX_FRAC*pi and all
144         # fractions are reduced. Ex. 15/16pi, 2/5pi, 15/2pi, 16/9pi
145         frac = np.where(np.abs(abs(single_inpt) - RECIP_MESH) < eps)
146         if frac[0].shape[0]:
147             numer = int(frac[1][0]) + 1
148             denom = int(frac[0][0]) + 1
149             if denom == 1 and output != 'qasm':
150                 denom = ''
151             if output == 'latex':
152                 str_out = '\\frac{%s%s}{%s%s}' % (neg_str, numer, denom, pi)
153             elif output == 'qasm':
154                 str_out = '{}{}/({}*{})'.format(neg_str, numer, denom, pi)
155             else:
156                 str_out = '{}{}/{}{}'.format(neg_str, numer, denom, pi)
157             return str_out
158 
159         # Nothing found
160         str_out = '{:.{}g}'.format(single_inpt, ndigits)
161         return str_out
162 
163     complex_inpt = complex(inpt)
164     real, imag = map(normalize, [complex_inpt.real, complex_inpt.imag])
165 
166     jstr = '\\jmath' if output == 'latex' else 'j'
167     if real == '0' and imag != '0':
168         str_out = imag + jstr
169     elif real != '0' and imag != '0':
170         op_str = '+'
171         # Remove + if imag negative except for latex fractions
172         if complex_inpt.imag < 0 and (output != 'latex' or '\\frac' not in imag):
173             op_str = ''
174         str_out = '{}{}{}{}'.format(real, op_str, imag, jstr)
175     else:
176         str_out = real
177     return str_out
178
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/qiskit/circuit/tools/pi_check.py b/qiskit/circuit/tools/pi_check.py
--- a/qiskit/circuit/tools/pi_check.py
+++ b/qiskit/circuit/tools/pi_check.py
@@ -67,7 +67,9 @@
         if abs(single_inpt) < 1e-14:
             return '0'
 
-        if output in ['text', 'qasm']:
+        if output == 'text':
+            pi = 'π'
+        elif output == 'qasm':
             pi = 'pi'
         elif output == 'latex':
             pi = '\\pi'

{"golden_diff": "diff --git a/qiskit/circuit/tools/pi_check.py b/qiskit/circuit/tools/pi_check.py\n--- a/qiskit/circuit/tools/pi_check.py\n+++ b/qiskit/circuit/tools/pi_check.py\n@@ -67,7 +67,9 @@\n         if abs(single_inpt) < 1e-14:\n             return '0'\n \n-        if output in ['text', 'qasm']:\n+        if output == 'text':\n+            pi = '\u03c0'\n+        elif output == 'qasm':\n             pi = 'pi'\n         elif output == 'latex':\n             pi = '\\\\pi'\n", "issue": "Show pi in the text drawer as \u03c0\n<!-- \u26a0\ufe0f If you do not respect this template, your issue will be closed -->\r\n<!-- \u26a0\ufe0f Make sure to browse the opened and closed issues to confirm this idea does not exist. -->\r\n\r\n### What is the expected enhancement?\r\n\r\nBased on a discussion in #4931, there's interest in displaying pi in the text drawer as `\u03c0 `instead of `pi`.\r\n``` \r\n                   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510               \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\r\nChange from   q_0: \u2524 RX(pij) \u251c     to   q_0: \u2524 RX(\u03c0j)  \u251c\r\n                   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518               \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\r\n```\r\nTo do this on all platforms requires completion of #4900 and modifying pi_check and 24 tests.\n", "before_files": [{"content": "# This code is part of Qiskit.\n#\n# (C) Copyright IBM 2017, 2019.\n#\n# This code is licensed under the Apache License, Version 2.0. You may\n# obtain a copy of this license in the LICENSE.txt file in the root directory\n# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.\n#\n# Any modifications or derivative works of this code must retain this\n# copyright notice, and modified files need to carry a notice indicating\n# that they have been altered from the originals.\n# pylint: disable=too-many-return-statements\n\n\"\"\"Check if number close to values of PI\n\"\"\"\n\nimport numpy as np\nfrom qiskit.circuit.parameterexpression import ParameterExpression\nfrom qiskit.exceptions import QiskitError\n\nMAX_FRAC = 16\nN, D = np.meshgrid(np.arange(1, MAX_FRAC+1), np.arange(1, MAX_FRAC+1))\nFRAC_MESH = N / D * np.pi\nRECIP_MESH = N / D / np.pi\nPOW_LIST = np.pi ** np.arange(2, 5)\n\n\ndef pi_check(inpt, eps=1e-6, output='text', ndigits=5):\n    \"\"\" Computes if a number is close to an integer\n    fraction or multiple of PI and returns the\n    corresponding string.\n\n    Args:\n        inpt (float): Number to check.\n        eps (float): EPS to check against.\n        output (str): Options are 'text' (default),\n                      'latex', 'mpl', and 'qasm'.\n        ndigits (int): Number of digits to print\n                       if returning raw inpt.\n\n    Returns:\n        str: string representation of output.\n\n    Raises:\n        QiskitError: if output is not a valid option.\n    \"\"\"\n    if isinstance(inpt, ParameterExpression):\n        param_str = str(inpt)\n        syms = inpt._symbol_expr.expr_free_symbols\n        for sym in syms:\n            if not sym.is_number:\n                continue\n            pi = pi_check(float(sym), eps=eps, output=output, ndigits=ndigits)\n            try:\n                _ = float(pi)\n            except (ValueError, TypeError):\n                # Strip leading '-' from pi since must replace with abs(sym)\n                # in order to preserve spacing around minuses in expression\n                if pi[0] == '-':\n                    pi = pi[1:]\n                param_str = param_str.replace(str(abs(sym)), pi)\n        return param_str\n    elif isinstance(inpt, str):\n        return inpt\n\n    def normalize(single_inpt):\n        if abs(single_inpt) < 1e-14:\n            return '0'\n\n        if output in ['text', 'qasm']:\n            pi = 'pi'\n        elif output == 'latex':\n            pi = '\\\\pi'\n        elif output == 'mpl':\n            pi = '$\\\\pi$'\n        else:\n            raise QiskitError('pi_check parameter output should be text, '\n                              'latex, mpl, or qasm.')\n\n        neg_str = '-' if single_inpt < 0 else ''\n\n        # First check is for whole multiples of pi\n        val = single_inpt / np.pi\n        if abs(val) >= 1 - eps:\n            if abs(abs(val) - abs(round(val))) < eps:\n                val = int(abs(round(val)))\n                if abs(val) == 1:\n                    str_out = '{}{}'.format(neg_str, pi)\n                else:\n                    if output == 'qasm':\n                        str_out = '{}{}*{}'.format(neg_str, val, pi)\n                    else:\n                        str_out = '{}{}{}'.format(neg_str, val, pi)\n                return str_out\n\n        # Second is a check for powers of pi\n        if abs(single_inpt) > np.pi:\n            power = np.where(abs(abs(single_inpt) - POW_LIST) < eps)\n            if power[0].shape[0]:\n                if output == 'qasm':\n                    str_out = '{:.{}g}'.format(single_inpt, ndigits)\n                elif output == 'latex':\n                    str_out = '{}{}^{}'.format(neg_str, pi, power[0][0] + 2)\n                elif output == 'mpl':\n                    str_out = '{}{}$^{}$'.format(neg_str, pi, power[0][0] + 2)\n                else:\n                    str_out = '{}{}**{}'.format(neg_str, pi, power[0][0] + 2)\n                return str_out\n\n        # Third is a check for a number larger than MAX_FRAC * pi, not a\n        # multiple or power of pi, since no fractions will exceed MAX_FRAC * pi\n        if abs(single_inpt) >= (MAX_FRAC * np.pi):\n            str_out = '{:.{}g}'.format(single_inpt, ndigits)\n            return str_out\n\n        # Fourth check is for fractions for 1*pi in the numer and any\n        # number in the denom.\n        val = np.pi / single_inpt\n        if abs(abs(val) - abs(round(val))) < eps:\n            val = int(abs(round(val)))\n            if output == 'latex':\n                str_out = '\\\\frac{%s%s}{%s}' % (neg_str, pi, val)\n            else:\n                str_out = '{}{}/{}'.format(neg_str, pi, val)\n            return str_out\n\n        # Fifth check is for fractions where the numer > 1*pi and numer\n        # is up to MAX_FRAC*pi and denom is up to MAX_FRAC and all\n        # fractions are reduced. Ex. 15pi/16, 2pi/5, 15pi/2, 16pi/9.\n        frac = np.where(np.abs(abs(single_inpt) - FRAC_MESH) < eps)\n        if frac[0].shape[0]:\n            numer = int(frac[1][0]) + 1\n            denom = int(frac[0][0]) + 1\n            if output == 'latex':\n                str_out = '\\\\frac{%s%s%s}{%s}' % (neg_str, numer, pi, denom)\n            elif output == 'qasm':\n                str_out = '{}{}*{}/{}'.format(neg_str, numer, pi, denom)\n            else:\n                str_out = '{}{}{}/{}'.format(neg_str, numer, pi, denom)\n            return str_out\n\n        # Sixth check is for fractions where the numer > 1 and numer\n        # is up to MAX_FRAC and denom is up to MAX_FRAC*pi and all\n        # fractions are reduced. Ex. 15/16pi, 2/5pi, 15/2pi, 16/9pi\n        frac = np.where(np.abs(abs(single_inpt) - RECIP_MESH) < eps)\n        if frac[0].shape[0]:\n            numer = int(frac[1][0]) + 1\n            denom = int(frac[0][0]) + 1\n            if denom == 1 and output != 'qasm':\n                denom = ''\n            if output == 'latex':\n                str_out = '\\\\frac{%s%s}{%s%s}' % (neg_str, numer, denom, pi)\n            elif output == 'qasm':\n                str_out = '{}{}/({}*{})'.format(neg_str, numer, denom, pi)\n            else:\n                str_out = '{}{}/{}{}'.format(neg_str, numer, denom, pi)\n            return str_out\n\n        # Nothing found\n        str_out = '{:.{}g}'.format(single_inpt, ndigits)\n        return str_out\n\n    complex_inpt = complex(inpt)\n    real, imag = map(normalize, [complex_inpt.real, complex_inpt.imag])\n\n    jstr = '\\\\jmath' if output == 'latex' else 'j'\n    if real == '0' and imag != '0':\n        str_out = imag + jstr\n    elif real != '0' and imag != '0':\n        op_str = '+'\n        # Remove + if imag negative except for latex fractions\n        if complex_inpt.imag < 0 and (output != 'latex' or '\\\\frac' not in imag):\n            op_str = ''\n        str_out = '{}{}{}{}'.format(real, op_str, imag, jstr)\n    else:\n        str_out = real\n    return str_out\n", "path": "qiskit/circuit/tools/pi_check.py"}], "after_files": [{"content": "# This code is part of Qiskit.\n#\n# (C) Copyright IBM 2017, 2019.\n#\n# This code is licensed under the Apache License, Version 2.0. You may\n# obtain a copy of this license in the LICENSE.txt file in the root directory\n# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.\n#\n# Any modifications or derivative works of this code must retain this\n# copyright notice, and modified files need to carry a notice indicating\n# that they have been altered from the originals.\n# pylint: disable=too-many-return-statements\n\n\"\"\"Check if number close to values of PI\n\"\"\"\n\nimport numpy as np\nfrom qiskit.circuit.parameterexpression import ParameterExpression\nfrom qiskit.exceptions import QiskitError\n\nMAX_FRAC = 16\nN, D = np.meshgrid(np.arange(1, MAX_FRAC+1), np.arange(1, MAX_FRAC+1))\nFRAC_MESH = N / D * np.pi\nRECIP_MESH = N / D / np.pi\nPOW_LIST = np.pi ** np.arange(2, 5)\n\n\ndef pi_check(inpt, eps=1e-6, output='text', ndigits=5):\n    \"\"\" Computes if a number is close to an integer\n    fraction or multiple of PI and returns the\n    corresponding string.\n\n    Args:\n        inpt (float): Number to check.\n        eps (float): EPS to check against.\n        output (str): Options are 'text' (default),\n                      'latex', 'mpl', and 'qasm'.\n        ndigits (int): Number of digits to print\n                       if returning raw inpt.\n\n    Returns:\n        str: string representation of output.\n\n    Raises:\n        QiskitError: if output is not a valid option.\n    \"\"\"\n    if isinstance(inpt, ParameterExpression):\n        param_str = str(inpt)\n        syms = inpt._symbol_expr.expr_free_symbols\n        for sym in syms:\n            if not sym.is_number:\n                continue\n            pi = pi_check(float(sym), eps=eps, output=output, ndigits=ndigits)\n            try:\n                _ = float(pi)\n            except (ValueError, TypeError):\n                # Strip leading '-' from pi since must replace with abs(sym)\n                # in order to preserve spacing around minuses in expression\n                if pi[0] == '-':\n                    pi = pi[1:]\n                param_str = param_str.replace(str(abs(sym)), pi)\n        return param_str\n    elif isinstance(inpt, str):\n        return inpt\n\n    def normalize(single_inpt):\n        if abs(single_inpt) < 1e-14:\n            return '0'\n\n        if output == 'text':\n            pi = '\u03c0'\n        elif output == 'qasm':\n            pi = 'pi'\n        elif output == 'latex':\n            pi = '\\\\pi'\n        elif output == 'mpl':\n            pi = '$\\\\pi$'\n        else:\n            raise QiskitError('pi_check parameter output should be text, '\n                              'latex, mpl, or qasm.')\n\n        neg_str = '-' if single_inpt < 0 else ''\n\n        # First check is for whole multiples of pi\n        val = single_inpt / np.pi\n        if abs(val) >= 1 - eps:\n            if abs(abs(val) - abs(round(val))) < eps:\n                val = int(abs(round(val)))\n                if abs(val) == 1:\n                    str_out = '{}{}'.format(neg_str, pi)\n                else:\n                    if output == 'qasm':\n                        str_out = '{}{}*{}'.format(neg_str, val, pi)\n                    else:\n                        str_out = '{}{}{}'.format(neg_str, val, pi)\n                return str_out\n\n        # Second is a check for powers of pi\n        if abs(single_inpt) > np.pi:\n            power = np.where(abs(abs(single_inpt) - POW_LIST) < eps)\n            if power[0].shape[0]:\n                if output == 'qasm':\n                    str_out = '{:.{}g}'.format(single_inpt, ndigits)\n                elif output == 'latex':\n                    str_out = '{}{}^{}'.format(neg_str, pi, power[0][0] + 2)\n                elif output == 'mpl':\n                    str_out = '{}{}$^{}$'.format(neg_str, pi, power[0][0] + 2)\n                else:\n                    str_out = '{}{}**{}'.format(neg_str, pi, power[0][0] + 2)\n                return str_out\n\n        # Third is a check for a number larger than MAX_FRAC * pi, not a\n        # multiple or power of pi, since no fractions will exceed MAX_FRAC * pi\n        if abs(single_inpt) >= (MAX_FRAC * np.pi):\n            str_out = '{:.{}g}'.format(single_inpt, ndigits)\n            return str_out\n\n        # Fourth check is for fractions for 1*pi in the numer and any\n        # number in the denom.\n        val = np.pi / single_inpt\n        if abs(abs(val) - abs(round(val))) < eps:\n            val = int(abs(round(val)))\n            if output == 'latex':\n                str_out = '\\\\frac{%s%s}{%s}' % (neg_str, pi, val)\n            else:\n                str_out = '{}{}/{}'.format(neg_str, pi, val)\n            return str_out\n\n        # Fifth check is for fractions where the numer > 1*pi and numer\n        # is up to MAX_FRAC*pi and denom is up to MAX_FRAC and all\n        # fractions are reduced. Ex. 15pi/16, 2pi/5, 15pi/2, 16pi/9.\n        frac = np.where(np.abs(abs(single_inpt) - FRAC_MESH) < eps)\n        if frac[0].shape[0]:\n            numer = int(frac[1][0]) + 1\n            denom = int(frac[0][0]) + 1\n            if output == 'latex':\n                str_out = '\\\\frac{%s%s%s}{%s}' % (neg_str, numer, pi, denom)\n            elif output == 'qasm':\n                str_out = '{}{}*{}/{}'.format(neg_str, numer, pi, denom)\n            else:\n                str_out = '{}{}{}/{}'.format(neg_str, numer, pi, denom)\n            return str_out\n\n        # Sixth check is for fractions where the numer > 1 and numer\n        # is up to MAX_FRAC and denom is up to MAX_FRAC*pi and all\n        # fractions are reduced. Ex. 15/16pi, 2/5pi, 15/2pi, 16/9pi\n        frac = np.where(np.abs(abs(single_inpt) - RECIP_MESH) < eps)\n        if frac[0].shape[0]:\n            numer = int(frac[1][0]) + 1\n            denom = int(frac[0][0]) + 1\n            if denom == 1 and output != 'qasm':\n                denom = ''\n            if output == 'latex':\n                str_out = '\\\\frac{%s%s}{%s%s}' % (neg_str, numer, denom, pi)\n            elif output == 'qasm':\n                str_out = '{}{}/({}*{})'.format(neg_str, numer, denom, pi)\n            else:\n                str_out = '{}{}/{}{}'.format(neg_str, numer, denom, pi)\n            return str_out\n\n        # Nothing found\n        str_out = '{:.{}g}'.format(single_inpt, ndigits)\n        return str_out\n\n    complex_inpt = complex(inpt)\n    real, imag = map(normalize, [complex_inpt.real, complex_inpt.imag])\n\n    jstr = '\\\\jmath' if output == 'latex' else 'j'\n    if real == '0' and imag != '0':\n        str_out = imag + jstr\n    elif real != '0' and imag != '0':\n        op_str = '+'\n        # Remove + if imag negative except for latex fractions\n        if complex_inpt.imag < 0 and (output != 'latex' or '\\\\frac' not in imag):\n            op_str = ''\n        str_out = '{}{}{}{}'.format(real, op_str, imag, jstr)\n    else:\n        str_out = real\n    return str_out\n", "path": "qiskit/circuit/tools/pi_check.py"}]}