Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def to_string(
data, header=None, alignment="l", padding=(0, 1), style=styles.thin_double
):
try:
depth = len(data.shape)
except AttributeError:
depth = _get_depth(data)
if depth == 2:
data = [data]
else:
assert depth == 3
if header:
data = [[header]] + data
# Make sure the data is consistent
num_columns = len(data[0][0])