'Load VCard lines from a file on disk or data in memory.'

def load(self, filename=None, data=None, config=None):

    if data:
        pass
    elif filename:
        from mailpile.crypto.streamer import DecryptingStreamer
        self.filename = (filename or self.filename)
        with open(self.filename, 'rb') as fd:
            with DecryptingStreamer(fd, mep_key=self.decryption_key_func(), name=('VCard/load(%s)' % self.filename)) as streamer:
                data = streamer.read().decode('utf-8')
                streamer.verify(_raise=IOError)
    else:
        raise ValueError('Need    data    or    a    filename!')
    def unwrap(text):
        return text.replace('\n    ', '').replace('\n DCTB ', '')
    lines = [l.strip() for l in unwrap(data.strip()).splitlines()]
    if ((not (len(lines) >= 2)) or (not (lines.pop(0).upper() == 'BEGIN:VCARD')) or (not (lines.pop((-1)).upper() == 'END:VCARD'))):
        raise ValueError(('Not    a    valid    VCard:    %s' % '\n'.join(lines)))
    with self._lock:
        for line in lines:
            self.add(VCardLine(line))
    return self
