def validate_creds(creds):
try:<EOL><INDENT>auth_type, auth_rest = creds.split('<STR_LIT::>', <NUM_LIT:1>)<EOL><DEDENT>except ValueError:<EOL><INDENT>raise ValueError("<STR_LIT>" % creds)<EOL><DEDENT>authtypes = sys.modules[__name__]<EOL>auth_encoder = getattr(authtypes, auth_type.title(), None)<EOL>if auth_encoder is None:<EOL><INDENT>raise ValueError('<STR_LIT>' % auth_type)<EOL><DEDENT>auth_encoder = auth_encoder()<EOL>parsed_creds = dict(type=auth_type, salt=None, hash=None)<EOL>parsed_creds.update(auth_encoder.validate(auth_rest))<EOL>return auth_encoder, parsed_creds<EOL>
Parse and validate user credentials whether format is right

    :param creds: User credentials
    :returns: Auth_type class instance and parsed user credentials in dict
    :raises ValueError: If credential format is wrong (eg: bad auth_type)