<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_node_edges(self,node,type="both"):
 """ given a node return the edges attached, by default get both incoming and outgoing :param node: :param type: :type node: Node :type type: string - default 'both' :returns: edge list :rtype: Edge[] edge list """

    if type == "both":
      return [self.__edges[x] for x in self.__edges if node.id in self.__edges[x].get_node_ids()]
    elif type == "outgoing":
      return [self.__edges[x] for x in self.__edges if node.id == self.__edges[x].get_node_ids()[0]]
    elif type == "incoming":
      return [self.__edges[x] for x in self.__edges if node.id == self.__edges[x].get_node_ids()[1]]
    sys.stderr.write("ERROR: type is not a type "+type+"\n")
    sys.exit()