def strip_comments(data, line_comment='#'):
    """Strip comments from the input string and return the result

    :param data: multiline text to strip comments from
    :type data: str
    :param line_comment: the line comment delimiter
    :type line_comment: str
    :rtype: str
    """

    return '\n'.join([l for l in data.splitlines()
                      if l and l[0] != line_comment]).strip()