def filtercomments(source):
    trailing_comments = []
    comment = True

    while comment:
        if re.search(r'^\s*\/\*', source):
            comment = source[0, source.index('*/') + 2]
        elif re.search(r'^\s*\/\/', source):
            comment = re.search(r'^\s*\/\/', source).group(0)
        else:
            comment = None

        if comment:
            source = re.sub(r'^\s+', '', source[len(comment):])
            trailing_comments.append(comment)

    return '\n'.join(trailing_comments) + source
NOT USED: strips trailing comments and put them at the top.
dataset/ETHPy150Open JT5D/Alfred-Popclip-Sublime/Sublime Text 2/JsFormat/libs/jsbeautifier/unpackers/__init__.py/filtercomments