def import_gwt_to_pyjamas(txt):
    """ this bit is specifically hard-coded to deal with gwt-dnd
        conversion.  almost everything else is "generic" java-to-python
    """
    if txt.startswith("package "):
        return ''
    if not txt.startswith('import '):
        return txt
    if txt == 'import com.google.gwt.dom.client.NativeEvent;':
        return 'from pyjamas.ui import Event'
    if txt.startswith('import com.google.gwt.user.client.ui.'):
        module = txt[37:-1]
        return "from pyjamas.ui.%s import %s" % (module, module)
    if txt.startswith('import com.google.gwt.user.client.'):
        module = txt[34:-1]
        if module == 'Element':
            return ''
        return "from pyjamas import %s" % module
    if txt.startswith('import com.allen_sauer.gwt.dnd.client.drop.'):
        module = txt[43:-1]
        return "from pyjamas.dnd.drop import %s" % module
    if txt.startswith('import com.allen_sauer.gwt.dnd.client.util.'):
        module = txt[43:-1]
        return "from pyjamas.dnd.util import %s" % module
    if txt.startswith('import com.googlecode.gchart.client.'):
        module = txt[36:-1]
        if module == 'GChart':
            return "from pyjamas.chart.GChart import GChart"
        return "from pyjamas.chart import %s" % module

    if txt.startswith('import com.allen_sauer.gwt.dnd.client.'):
        module = txt[38:-1]
        return "from pyjamas.dnd import %s" % module
    return ''
dataset/ETHPy150Open anandology/pyjamas/contrib/java2py.py/import_gwt_to_pyjamas/original