def load_and_validate_keys(authorized_keys):
if not authorized_keys:<EOL><INDENT>return None<EOL><DEDENT>if not isinstance(authorized_keys, list):<EOL><INDENT>authorized_keys = [authorized_keys]<EOL><DEDENT>ret = []<EOL>for k in authorized_keys:<EOL><INDENT>accepted_types = ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>')<EOL>if any([ t for t in accepted_types if k.startswith(t) ]):<EOL><INDENT>ret.append(k)<EOL><DEDENT>else:<EOL><INDENT>k = os.path.expanduser(k)<EOL>if os.path.isfile(k):<EOL><INDENT>with open(k) as f:<EOL><INDENT>ret.append(f.read().rstrip())<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(accepted_types))<EOL><DEDENT><DEDENT><DEDENT>return ret<EOL>
Loads authorized_keys as taken by :any:`instance_create`,
:any:`disk_create` or :any:`rebuild`, and loads in any keys from any files
provided.

:param authorized_keys: A list of keys or paths to keys, or a single key

:returns: A list of raw keys
:raises: ValueError if keys in authorized_keys don't appear to be a raw
         key and can't be opened.