'used to import a role into Ansible Galaxy'

def execute_import(self):

    colors = {'INFO': 'normal', 'WARNING': C.COLOR_WARN, 'ERROR': C.COLOR_ERROR, 'SUCCESS': C.COLOR_OK, 'FAILED': C.COLOR_ERROR}
    if (len(self.args) < 2):
        raise AnsibleError('Expected    a    github_username    and    github_repository.    Use    --help.')
    github_repo = to_text(self.args.pop(), errors='surrogate_or_strict')
    github_user = to_text(self.args.pop(), errors='surrogate_or_strict')
    if self.options.check_status:
        task = self.api.get_import_task(github_user=github_user, github_repo=github_repo)
    else:
        task = self.api.create_import_task(github_user, github_repo, reference=self.options.reference, role_name=self.options.role_name)
        if (len(task) > 1):
            display.display(('WARNING:    More    than    one    Galaxy    role    associated    with    Github    repo    %s/%s.' % (github_user, github_repo)), color='yellow')
            display.display(('The    following    Galaxy    roles    are    being    updated:' + u'\n'), color=C.COLOR_CHANGED)
            for t in task:
                display.display(('%s.%s' % (t['summary_fields']['role']['namespace'], t['summary_fields']['role']['name'])), color=C.COLOR_CHANGED)
            display.display((u'\nTo    properly    namespace    this    role,    remove    each    of    the    above    and    re-import    %s/%s    from    scratch' % (github_user, github_repo)), color=C.COLOR_CHANGED)
            return 0
        display.display(('Successfully    submitted    import    request    %d' % task[0]['id']))
        if (not self.options.wait):
            display.display(('Role    name:    %s' % task[0]['summary_fields']['role']['name']))
            display.display(('Repo:    %s/%s' % (task[0]['github_user'], task[0]['github_repo'])))
    if (self.options.check_status or self.options.wait):
        msg_list = []
        finished = False
        while (not finished):
            task = self.api.get_import_task(task_id=task[0]['id'])
            for msg in task[0]['summary_fields']['task_messages']:
                if (msg['id'] not in msg_list):
                    display.display(msg['message_text'], color=colors[msg['message_type']])
                    msg_list.append(msg['id'])
            if (task[0]['state'] in ['SUCCESS', 'FAILED']):
                finished = True
            else:
                time.sleep(10)
    return 0
