def make_autoname(key='', doctype='', doc=''):
	"""
   Creates an autoname from the given key:

   **Autoname rules:**

         * The key is separated by '.'
         * '####' represents a series. The string before this part becomes the prefix:
            Example: ABC.#### creates a series ABC0001, ABC0002 etc
         * 'MM' represents the current month
         * 'YY' and 'YYYY' represent the current year


   *Example:*

         * DE/./.YY./.MM./.##### will create a series like
           DE/09/01/0001 where 09 is the year, 01 is the month and 0001 is the series
	"""
	if key=="hash":
		return frappe.generate_hash(doctype, 10)

	if not key in "#":
		key = key + ".#####"
	elif not "." in key:
		frappe.throw(_("Invalid naming series (. missing)") + (_(" for {0}").format(doctype) if doctype else ""))

	n = ''
	l = key.split('.')
	series_set = False
	today = now_datetime()

	for e in l:
		part = ''
		if e.startswith('#'):
			if not series_set:
				digits = len(e)
				part = getseries(n, digits, doctype)
				series_set = True
		elif e=='YY':
			part = today.strftime('%y')
		elif e=='MM':
			part = today.strftime('%m')
		elif e=='DD':
			part = today.strftime("%d")
		elif e=='YYYY':
			part = today.strftime('%Y')
		elif doc and doc.get(e):
			part = doc.get(e)
		else: part = e

		if isinstance(part, basestring):
			n+=part
	return n
dataset/ETHPy150Open frappe/frappe/frappe/model/naming.py/make_autoname/swapped operands of `in`