<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def labels(ctx):
 """Crate or update labels in github """

    config = ctx.obj['agile']
    repos = config.get('repositories')
    labels = config.get('labels')
    if not isinstance(repos, list):
        raise CommandError(
            'You need to specify the "repos" list in the config'
        )
    if not isinstance(labels, dict):
        raise CommandError(
            'You need to specify the "labels" dictionary in the config'
        )
    git = GithubApi()
    for repo in repos:
        repo = git.repo(repo)
        for label, color in labels.items():
            if repo.label(label, color):
                click.echo('Created label "%s" @ %s' % (label, repo))
            else:
                click.echo('Updated label "%s" @ %s' % (label, repo))