'Convert the top-level \'secrets\' directive to the Docker format
:return: secrets dict'

@conductor_only
def _get_top_level_secrets(self):

    top_level_secrets = dict()
    if self.secrets:
        for (secret, secret_definition) in iteritems(self.secrets):
            if isinstance(secret_definition, dict):
                for (key, value) in iteritems(secret_definition):
                    name = '{}_{}'.format(secret, key)
                    top_level_secrets[name] = dict(external=True)
            elif isinstance(secret_definition, string_types):
                top_level_secrets[secret] = dict(external=True)
    return top_level_secrets
