def _get_vcap_services(vcap_services=None):
vcap_services = vcap_services or os.environ.get('<STR_LIT>')<EOL>if not vcap_services:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>")<EOL><DEDENT>if isinstance(vcap_services, dict):<EOL><INDENT>return vcap_services<EOL><DEDENT>try:<EOL><INDENT>vcap_services = json.loads(vcap_services)<EOL><DEDENT>except json.JSONDecodeError:<EOL><INDENT>try:<EOL><INDENT>with open(vcap_services) as vcap_json_data:<EOL><INDENT>vcap_services = json.load(vcap_json_data)<EOL><DEDENT><DEDENT>except:<EOL><INDENT>raise ValueError("<STR_LIT>", vcap_services)<EOL><DEDENT><DEDENT>return vcap_services<EOL>
Retrieves the VCAP Services information from the `ConfigParams.VCAP_SERVICES` field in the config object. If
    `vcap_services` is not specified, it takes the information from VCAP_SERVICES environment variable.

    Args:
        vcap_services (str): Try to parse as a JSON string, otherwise, try open it as a file.
        vcap_services (dict): Return the dict as is.

    Returns:
        dict: A dict representation of the VCAP Services information.

    Raises:
        ValueError:
            * if `vcap_services` nor VCAP_SERVICES environment variable are specified.
            * cannot parse `vcap_services` as a JSON string nor as a filename.