'Create a partner from lead data
:returns res.partner record'

@api.multi
def _create_lead_partner(self):

    contact_name = self.contact_name
    if (not contact_name):
        contact_name = (self.env['res.partner']._parse_partner_name(self.email_from)[0] if self.email_from else False)
    if self.partner_name:
        partner_company = self._lead_create_contact(self.partner_name, True)
    elif self.partner_id:
        partner_company = self.partner_id
    else:
        partner_company = None
    if contact_name:
        return self._lead_create_contact(contact_name, False, (partner_company.id if partner_company else False))
    if partner_company:
        return partner_company
    return self._lead_create_contact(self.name, False)
