def get_pokemon_moves(self, obj):

        version_objects = VersionGroup.objects.all()
        version_data = VersionGroupSummarySerializer(
            version_objects, many=True, context=self.context).data
        method_objects = MoveLearnMethod.objects.all()
        method_data = MoveLearnMethodSummarySerializer(
            method_objects, many=True, context=self.context).data

        '''
        Get moves related to this pokemon and pull out unique Move IDs.
        Note that it's important to order by the same column we're using to
        determine if the entries are unique.  Otherwise distinct() will
        return apparent duplicates.
        '''
        pokemon_moves = PokemonMove.objects.filter(pokemon_id=obj).order_by('move_id')
        move_ids = pokemon_moves.values('move_id').distinct()
        move_list = []

        for id in move_ids:

            pokemon_move_details = OrderedDict()

            # Get each Unique Move by ID
            move_object = Move.objects.get(pk=id['move_id'])
            move_data = MoveSummarySerializer(move_object, context=self.context).data
            pokemon_move_details['move'] = move_data

            # Get Versions and Move Methods associated with each unique move
            pokemon_move_objects = pokemon_moves.filter(move_id=id['move_id'])
            serializer = PokemonMoveSerializer(
                pokemon_move_objects, many=True, context=self.context)
            pokemon_move_details['version_group_details'] = []

            for move in serializer.data:

                version_detail = OrderedDict()

                version_detail['level_learned_at'] = move['level']
                version_detail['version_group'] = version_data[move['version_group'] - 1]
                version_detail['move_learn_method'] = method_data[move['move_learn_method'] - 1]

                pokemon_move_details['version_group_details'].append(version_detail)

            move_list.append(pokemon_move_details)

        return move_list
dataset/ETHPy150Open phalt/pokeapi/pokemon_v2/serializers.py/PokemonDetailSerializer.get_pokemon_moves/original