def _get_credentials(vcap_services, service_name=None):
service_name = service_name or os.environ.get('<STR_LIT>', None)<EOL>services = vcap_services['<STR_LIT>']<EOL>creds = None<EOL>for service in services:<EOL><INDENT>if service['<STR_LIT:name>'] == service_name:<EOL><INDENT>creds = service['<STR_LIT>']<EOL>break<EOL><DEDENT><DEDENT>if creds is None:<EOL><INDENT>raise ValueError("<STR_LIT>" + str(service_name) + "<STR_LIT>")<EOL><DEDENT>return creds<EOL>
Retrieves the credentials of the VCAP Service of the specified `service_name`.  If
    `service_name` is not specified, it takes the information from STREAMING_ANALYTICS_SERVICE_NAME environment
    variable.

    Args:
        vcap_services (dict): A dict representation of the VCAP Services information.
        service_name (str): One of the service name stored in `vcap_services`

    Returns:
        dict: A dict representation of the credentials.

    Raises:
        ValueError:  Cannot find `service_name` in `vcap_services`