'Execute the management command to generate the email opt-in list.
Arguments:
org (unicode): The org to generate the report for.
Keyword Arguments:
other_names (list): List of other aliases for the org.
only_courses (list): If provided, include only these course IDs in the report.
query_interval (int): If provided, override the default query interval.
Returns:
list: The rows of the generated CSV report.  Each item is a dictionary.'

def _run_command(self, org, other_names=None, only_courses=None, query_interval=None):

    temp_dir_path = tempfile.mkdtemp()
    self.addCleanup(shutil.rmtree, temp_dir_path)
    if (other_names is None):
        other_names = []
    output_path = os.path.join(temp_dir_path, self.OUTPUT_FILE_NAME)
    org_list = ([org] + other_names)
    if (only_courses is not None):
        only_courses = ','.join((unicode(course_id) for course_id in only_courses))
    command = email_opt_in_list.Command()
    if (query_interval is not None):
        command.QUERY_INTERVAL = query_interval
    command.handle(output_path, courses=only_courses, *org_list)
    try:
        with open(output_path) as output_file:
            reader = csv.DictReader(output_file, fieldnames=self.OUTPUT_FIELD_NAMES)
            rows = [row for row in reader]
    except IOError:
        self.fail("Could    not    find    or    open    output    file    at    '{path}'".format(path=output_path))
    return rows
