Generate a Key instance from a file. Raise ValueError is key is
        malformed

def from_pubkey_file(cls, file):
        """Generate a Key instance from a file. Raise ValueError is key is
        malformed"""
        if hasattr(file, 'read'):
            return cls.from_pubkey_line(file.read())

        return cls.from_pubkey_line(open(file).read())