@staticmethod
    def _create_scoped_credentials(credentials, scope):
        """Create a scoped set of credentials if it is required.

        :type credentials: :class:`oauth2client.client.OAuth2Credentials` or
                           :class:`NoneType`
        :param credentials: The OAuth2 Credentials to add a scope to.

        :type scope: list of URLs
        :param scope: the effective service auth scopes for the connection.

        :rtype: :class:`oauth2client.client.OAuth2Credentials` or
                :class:`NoneType`
        :returns: A new credentials object that has a scope added (if needed).
        """
        if credentials:
            try:
                if credentials.create_scoped_required():
                    credentials = credentials.create_scoped(scope)
            except __HOLE__:
                pass
        return credentials
dataset/ETHPy150Open GoogleCloudPlatform/gcloud-python/gcloud/connection.py/Connection._create_scoped_credentials