'Returns the string representation of \'self\'.
Examples
>>> from sympy import TableForm
>>> t = TableForm([[5, 7], [4, 2], [10, 3]])
>>> s = t.as_str()'

def _sympystr(self, p):

    column_widths = ([0] * self._w)
    lines = []
    for line in self._lines:
        new_line = []
        for i in range(self._w):
            s = str(line[i])
            if (self._wipe_zeros and (s == '0')):
                s = '    '
            w = len(s)
            if (w > column_widths[i]):
                column_widths[i] = w
            new_line.append(s)
        lines.append(new_line)
    if self._headings[0]:
        self._headings[0] = [str(x) for x in self._headings[0]]
        _head_width = max([len(x) for x in self._headings[0]])
    if self._headings[1]:
        new_line = []
        for i in range(self._w):
            s = str(self._headings[1][i])
            w = len(s)
            if (w > column_widths[i]):
                column_widths[i] = w
            new_line.append(s)
        self._headings[1] = new_line
    format_str = []
    def _align(align, w):
        return ('%%%s%ss' % (('-' if (align == 'l') else ''), str(w)))
    format_str = [_align(align, w) for (align, w) in zip(self._alignments, column_widths)]
    if self._headings[0]:
        format_str.insert(0, _align(self._head_align, _head_width))
        format_str.insert(1, '|')
    format_str = ('    '.join(format_str) + '\n')
    s = []
    if self._headings[1]:
        d = self._headings[1]
        if self._headings[0]:
            d = ([''] + d)
        first_line = (format_str % tuple(d))
        s.append(first_line)
        s.append((('-' * (len(first_line) - 1)) + '\n'))
    for (i, line) in enumerate(lines):
        d = [(l if (self._alignments[j] != 'c') else l.center(column_widths[j])) for (j, l) in enumerate(line)]
        if self._headings[0]:
            l = self._headings[0][i]
            l = (l if (self._head_align != 'c') else l.center(_head_width))
            d = ([l] + d)
        s.append((format_str % tuple(d)))
    return ''.join(s)[:(-1)]
