# Path: androguard/core/androconf.py
# CONF = Configuration()
# 
# def color_range(startcolor, goalcolor, steps):
#     """
#     wrapper for interpolate_tuple that accepts colors as html ("#CCCCC" and such)
#     """
#     start_tuple = make_color_tuple(startcolor)
#     goal_tuple = make_color_tuple(goalcolor)
# 
#     return interpolate_tuple(start_tuple, goal_tuple, steps)
# 
# Path: androguard/core/bytecodes/dvm_types.py
# class Kind(IntEnum):
#     """
#     This Enum is used to determine the kind of argument
#     inside an Dalvik instruction.
# 
#     It is used to reference the actual item instead of the refernece index
#     from the :class:`ClassManager` when disassembling the bytecode.
#     """
#     # Indicates a method reference
#     METH = 0
#     # Indicates that opcode argument is a string index
#     STRING = 1
#     # Indicates a field reference
#     FIELD = 2
#     # Indicates a type reference
#     TYPE = 3
#     # indicates a prototype reference
#     PROTO = 9
#     # indicates method reference and proto reference (invoke-polymorphic)
#     METH_PROTO = 10
#     # indicates call site item
#     CALL_SITE = 11
# 
#     # TODO: not very well documented
#     VARIES = 4
#     # inline lined stuff
#     INLINE_METHOD = 5
#     # static linked stuff
#     VTABLE_OFFSET = 6
#     FIELD_OFFSET = 7
#     RAW_STRING = 8
# 
# class Operand(IntEnum):
#     """
#     Enumeration used for the operand type of opcodes
#     """
#     REGISTER = 0
#     LITERAL = 1
#     RAW = 2
#     OFFSET = 3
#     # FIXME: KIND is used in combination with others, ie the Kind enum, therefore it is 0x100...
#     # thus we could use an IntFlag here as well
#     KIND = 0x100


import hashlib
import textwrap
import json
import logging
    import pydot
from xml.sax.saxutils import escape
from struct import pack
from androguard.core.androconf import CONF, color_range
from androguard.core.bytecodes.dvm_types import Kind, Operand
                                  normal_color)

            idx += ins.get_length()

            print_fct("\n")

        if i.get_exception_analysis():
            print_fct("\t%s%s%s\n" %
                      (exception_color, i.exception_analysis.show_buff(),
                       normal_color))

        print_fct("\n")


def _get_operand_html(operand, registers_colors, colors):
    """
    Return a HTML representation of the operand.
    The HTML should be compatible with pydot/graphviz to be used
    inside a node label.

    This is solely used in :func:`~androguard.core.bytecodes.method2dot`

    :param operand: tuple containing the operand type and operands
    :param dict register_colors: key: register number, value: register color
    :param dict colors: dictionary containing the register colors
    :returns: HTML code of the operands
    """
    if operand[0] == Operand.REGISTER:
        return '<FONT color="{}">v{}</FONT>'.format(registers_colors[operand[1]], operand[1])


# Path: androguard/core/androconf.py
# CONF = Configuration()
# 
# def color_range(startcolor, goalcolor, steps):
#     """
#     wrapper for interpolate_tuple that accepts colors as html ("#CCCCC" and such)
#     """
#     start_tuple = make_color_tuple(startcolor)
#     goal_tuple = make_color_tuple(goalcolor)
# 
#     return interpolate_tuple(start_tuple, goal_tuple, steps)
# 
# Path: androguard/core/bytecodes/dvm_types.py
# class Kind(IntEnum):
#     """
#     This Enum is used to determine the kind of argument
#     inside an Dalvik instruction.
# 
#     It is used to reference the actual item instead of the refernece index
#     from the :class:`ClassManager` when disassembling the bytecode.
#     """
#     # Indicates a method reference
#     METH = 0
#     # Indicates that opcode argument is a string index
#     STRING = 1
#     # Indicates a field reference
#     FIELD = 2
#     # Indicates a type reference
#     TYPE = 3
#     # indicates a prototype reference
#     PROTO = 9
#     # indicates method reference and proto reference (invoke-polymorphic)
#     METH_PROTO = 10
#     # indicates call site item
#     CALL_SITE = 11
# 
#     # TODO: not very well documented
#     VARIES = 4
#     # inline lined stuff
#     INLINE_METHOD = 5
#     # static linked stuff
#     VTABLE_OFFSET = 6
#     FIELD_OFFSET = 7
#     RAW_STRING = 8
# 
# class Operand(IntEnum):
#     """
#     Enumeration used for the operand type of opcodes
#     """
#     REGISTER = 0
#     LITERAL = 1
#     RAW = 2
#     OFFSET = 3
#     # FIXME: KIND is used in combination with others, ie the Kind enum, therefore it is 0x100...
#     # thus we could use an IntFlag here as well
#     KIND = 0x100


# Path: androguard/core/bytecode.py
import hashlib
import textwrap
import json
import logging
    import pydot
from xml.sax.saxutils import escape
from struct import pack
from androguard.core.androconf import CONF, color_range
from androguard.core.bytecodes.dvm_types import Kind, Operand

                                  normal_color)

            idx += ins.get_length()

            print_fct("\n")

        if i.get_exception_analysis():
            print_fct("\t%s%s%s\n" %
                      (exception_color, i.exception_analysis.show_buff(),
                       normal_color))

        print_fct("\n")


def _get_operand_html(operand, registers_colors, colors):
    """
    Return a HTML representation of the operand.
    The HTML should be compatible with pydot/graphviz to be used
    inside a node label.

    This is solely used in :func:`~androguard.core.bytecodes.method2dot`

    :param operand: tuple containing the operand type and operands
    :param dict register_colors: key: register number, value: register color
    :param dict colors: dictionary containing the register colors
    :returns: HTML code of the operands
    """
    if operand[0] == Operand.REGISTER:
        return '<FONT color="{}">v{}</FONT>'.format(registers_colors[operand[1]], operand[1])


    if operand[0] == Operand.LITERAL: