<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def domain_search(self, domain=None, company=None, limit=None, offset=None, emails_type=None, raw=False):
 """ Return all the email addresses found for a given domain. :param domain: The domain on which to search for emails. Must be defined if company is not. :param company: The name of the company on which to search for emails. Must be defined if domain is not. :param limit: The maximum number of emails to give back. Default is 10. :param offset: The number of emails to skip. Default is 0. :param emails_type: The type of emails to give back. Can be one of 'personal' or 'generic'. :param raw: Gives back the entire response instead of just the 'data'. :return: Full payload of the query as a dict, with email addresses found. """

        if not domain and not company:
            raise MissingCompanyError(
                'You must supply at least a domain name or a company name'
            )

        if domain:
            params = {'domain': domain, 'api_key': self.api_key}
        elif company:
            params = {'company': company, 'api_key': self.api_key}

        if limit:
            params['limit'] = limit

        if offset:
            params['offset'] = offset

        if emails_type:
            params['type'] = emails_type

        endpoint = self.base_endpoint.format('domain-search')

        return self._query_hunter(endpoint, params, raw=raw)