def valid(name, maxlength=None):
if not name:<EOL><INDENT>return None<EOL><DEDENT>if maxlength is not None and len(name) > maxlength:<EOL><INDENT>return None<EOL><DEDENT>name = name.lower()<EOL>if name.endswith('<STR_LIT:->') or name.startswith('<STR_LIT:->') or '<STR_LIT>' in name:<EOL><INDENT>return None<EOL><DEDENT>if name[<NUM_LIT:0>] in string.digits:<EOL><INDENT>return None<EOL><DEDENT>for c in name:<EOL><INDENT>if c not in string.digits+string.ascii_lowercase+'<STR_LIT:->':<EOL><INDENT>return None<EOL><DEDENT><DEDENT>return name<EOL>
Return the lowercase name if this name adheres to requirements, None
otherwise.
The requirements are:
  * only alphanumeric characters or dashes
  * no number at the start
  * no double dashes or dashes at the start or end of the name
  * no empty string
  * no string bigger than maxlength