<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _valid_baremetal_port(port):
 """Check if port is a baremetal port with exactly one security group"""

        if port.get(portbindings.VNIC_TYPE) != portbindings.VNIC_BAREMETAL:
            return False
        sgs = port.get('security_groups', [])
        if len(sgs) == 0:
            # Nothing to do
            return False
        if len(port.get('security_groups', [])) > 1:
            LOG.warning('SG provisioning failed for %(port)s. Only one '
                        'SG may be applied per port.',
                        {'port': port['id']})
            return False
        return True