code: def validate_name(name, maxlen=80):
      
      if not isinstance(name, basestring):
          msg = "Name must be of type string"
          raise InvalidAwsLambdaName(msg)
      if len(name) > maxlen:
          msg = "Name is longer than {maxlen} characters."
          raise InvalidAwsLambdaName(msg.format(maxlen=maxlen))
      if len(name) == 0:
          msg = "Name must not be empty string."
          raise InvalidAwsLambdaName(msg)
      if not re.match("^[a-zA-Z0-9-_]+$", name):
          msg = "Name can only contain characters from a-z, A-Z, 0-9, _ and -"
          raise InvalidAwsLambdaName(msg)
      return name
docs: Validate name for AWS Lambda function.
      name: actual name (without `arn:aws:lambda:...:` prefix and without
          `:$LATEST`, alias or version suffix.
      maxlen: max allowed length for name without prefix and suffix.
  
      The value 80 was calculated from prefix with longest known region name
      and assuming that no alias or version would be longer than `$LATEST`.
  
      Based on AWS Lambda spec
      http://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html
  
      Return: the name
      Raise: InvalidAwsLambdaName, if the name is invalid.