Yes, it got messy... I usually follow that:

    Imports should be grouped in the following order:

        1. standard library imports
        2. related third party imports
        3. local application/library specific imports