<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
 """ Limit canned reply options to those with same site as comment. """

        field = super(CommentReplyAdmin, self).\
            formfield_for_foreignkey(db_field, request, **kwargs)
        comment_id = request.GET.get(self.fk_name, None)

        if db_field.name == 'canned_reply' and comment_id:
            comment_id = comment_id.split(',')
            comment_sites = Comment.objects.filter(id__in=comment_id)\
                                           .values('site')\
                                           .distinct()
            field.queryset = field.queryset.filter(Q(site__in=comment_sites) |
                                                   Q(site__isnull=True))
        return field