'remove domain from domain settings'

def remove_from_active_domains(self, domain=None, remove_all=False):

    if (not domain):
        return
    domain_settings = frappe.get_doc(u'Domain    Settings', u'Domain    Settings')
    if remove_all:
        domain_settings.set(u'active_domains', [])
    else:
        to_remove = []
        [to_remove.append(row) for row in domain_settings.active_domains if (row.domain == domain)]
        [domain_settings.remove(row) for row in to_remove]
    domain_settings.save()
