@staticmethod
def ensure_part(piece_id, part_name, conn, cursor):
    """
        Ensure given part is included
            :param piece_id: Id of source piece
            :param part_name: Name of the part
            :param conn: Connection to sqlite instance
            :param cursor: Cursor to use
        """
    cursor.execute('SELECT id FROM parts WHERE piece_id=? AND name=? LIMIT 1',
        (piece_id, part_name))
    results = cursor.fetchall()
    if results:
        return results[0][0]
    cursor.execute('INSERT INTO parts (piece_id, name) VALUES (?, ?)', (
        piece_id, part_name))
    conn.commit()
    return cursor.lastrowid
