Get entity configuration in python script / integration

Sorry for the stupid question.
I have several switch types in my home with different configuration and I need to perform some action with them. Action logic depends on switch configuration. For example if Switch is MQTT and command_topiс contains “-bridge-” - perform some extra steps.

But I can’t find how to get configuration yaml (dictionary) having only entity_id.

I can get state like

toilet_light= hass.states.get('switch.toilet_light')

but how to return configuration below?

  - platform: mqtt
    name: toilet_light
    availability_topic: 'tele/rf-bridge-first-floor/LWT'
    payload_available: 'Online'
    payload_not_available: 'Offline'
    state_topic: 'stat/rf-sensor-toilet/STATE'
    state_off: 'OFF'
    state_on: 'ON'
    command_topic: 'cmnd/rf-bridge-first-floor'
    payload_on:  "on"
    payload_off: "off"

Will answer for myself, maybe will be useful for others.

In custom_component - entire configuration made manually (via configuration.yaml)- is passes to

def setup(hass, config):

method. configuration is passed as OrderedDict.
In python_scrips - seems that it is impossible, as hass object passed to script- config parameters of hass is restricted from access.