def fix_string(code):
    """
    Fix indentation and empty lines from string coming out of the function.
    """
    lines = code.split('\n')

    # Remove first line if empty
    if not lines[0]:
        lines = lines[1:]

    # Detect tabsize
    size = 0
    while lines[0][size] in ' ':
        size += 1

    lines = list(map(lambda l: l[size:], lines))

    if not lines[-1]:
        lines = lines[:-1]

    code = '\n'.join(lines)
    return code