<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def extract_repos(config, cwd=os.getcwd()):
 """Return expanded configuration. end-user configuration permit inline configuration shortcuts, expand to identical format for parsing. :param config: the repo config in :py:class:`dict` format. :type config: dict :param cwd: current working dir (for deciphering relative paths) :type cwd: str :rtype: list """

    configs = []
    for directory, repos in config.items():
        for repo, repo_data in repos.items():

            conf = {}

            '''
            repo_name: http://myrepo.com/repo.git

            to

            repo_name: { url: 'http://myrepo.com/repo.git' }

            also assures the repo is a :py:class:`dict`.
            '''

            if isinstance(repo_data, string_types):
                conf['url'] = repo_data
            else:
                conf = update_dict(conf, repo_data)

            if 'repo' in conf:
                if 'url' not in conf:
                    conf['url'] = conf.pop('repo')
                else:
                    conf.pop('repo', None)

            '''
            ``shell_command_after``: if str, turn to list.
            '''
            if 'shell_command_after' in conf:
                if isinstance(conf['shell_command_after'], string_types):
                    conf['shell_command_after'] = [conf['shell_command_after']]

            if 'name' not in conf:
                conf['name'] = repo
            if 'parent_dir' not in conf:
                conf['parent_dir'] = expand_dir(directory, cwd)

            if 'repo_dir' not in conf:
                conf['repo_dir'] = expand_dir(
                    os.path.join(conf['parent_dir'], conf['name']), cwd
                )
            if 'remotes' in conf:
                remotes = []
                for remote_name, url in conf['remotes'].items():
                    remotes.append({'remote_name': remote_name, 'url': url})
                conf['remotes'] = sorted(
                    remotes, key=lambda x: sorted(x.get('remote_name'))
                )
            configs.append(conf)

    return configs