<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_new_connection(from_port, to_port):
 """Checks the type of connection and tries to create it If bot port are logical port,s a transition is created. If both ports are data ports (including scoped variable), then a data flow is added. An error log is created, when the types are not compatible. :param from_port: The starting port of the connection :param to_port: The end point of the connection :return: True if a new connection was added """

    from rafcon.gui.mygaphas.items.ports import ScopedVariablePortView, LogicPortView, DataPortView

    if isinstance(from_port, LogicPortView) and isinstance(to_port, LogicPortView):
        return add_transition_to_state(from_port, to_port)
    elif isinstance(from_port, (DataPortView, ScopedVariablePortView)) and \
            isinstance(to_port, (DataPortView, ScopedVariablePortView)):
        return add_data_flow_to_state(from_port, to_port)
    # Both ports are not None
    elif from_port and to_port:
        logger.error("Connection of non-compatible ports: {0} and {1}".format(type(from_port), type(to_port)))

    return False