Write a function that takes a piece of text in the form of a string and returns the letter frequency count for the text. This count excludes numbers, spaces and all punctuation marks. Upper and lower case versions of a character are equivalent and the result should all be in lowercase.

The function should return a list of tuples (in Python and Haskell) or arrays (in other languages) sorted by the most frequent letters first. The Rust implementation should return an ordered BTreeMap.
Letters with the same frequency are ordered alphabetically.
For example:

```python
  letter_frequency('aaAabb dddDD hhcc')
```  
```C++
  letter_frequency("aaAabb dddDD hhcc")
```

will return

```python
  [('d',5), ('a',4), ('b',2), ('c',2), ('h',2)]
```  
```C++
  std::vector>{{'d',5}, {'a',4}, {'b',2}, {'c',2}, {'h',2}}
```

Letter frequency analysis is often used to analyse simple substitution cipher texts like those created by the Caesar cipher.

Difficulty: introductory

Starter code:

def letter_frequency(text):
	

Solutions:
from collections import Counter
from operator import itemgetter

def letter_frequency(text):
    items = Counter(c for c in text.lower() if c.isalpha()).items()
    return sorted(
        sorted(items, key=itemgetter(0)),
        key=itemgetter(1),
        reverse=True
    )

from collections import Counter
def letter_frequency(text):
  return sorted(Counter(filter(str.isalpha, 
                        text.lower())
                        ).most_common(), 
                key=lambda t:(-t[1],t[0]))

# return a list of tuples sorted by frequency with
# the most frequent letter first. Any letters with the
# same frequency are ordered alphabetically

def letter_frequency(text):
  text = text.lower()
  freq = sorted([(l, text.count(l)) for l in set(text) if l.isalpha()], key=lambda k: k[0])
  return sorted(freq, key=lambda k: k[1], reverse=True)

def letter_frequency(text):
    d = {}
    for i in text:
        if i.isalpha():
            i = i.lower()
            d[i] = d[i] + 1 if i in d else 1
    return sorted(d.items(), key=lambda (k, v): (-v, k))

import re
from collections import Counter
def letter_frequency(text):
  letters = re.findall('[a-z]', text.lower())
  freqs   = Counter(letters).most_common()
  return sorted(freqs, lambda a, b: cmp(b[1], a[1]) or cmp(a[0], b[0]))

def letter_frequency(text):
  text = text.lower()
  freq_count = [(c, text.count(c)) for c in text if c.isalpha()]
  return sorted(list(set(freq_count)), key=lambda x: (-x[1], x[0]))



from collections import Counter

def letter_frequency(text):   
    return sorted(Counter(''.join([c for c in text.lower() if c.isalpha()])).items(), key=lambda x: (-x[1],x[0]))

def letter_frequency(text):
  text = [c for c in text.lower() if c.isalpha()]
  result = [(char, text.count(char)) for char in sorted(set(text))]
  return sorted(result, key = lambda char_freq: char_freq[1], reverse = True)


from collections import Counter

def letter_frequency(text):
    cnts = Counter(c for c in text.lower() if c.isalpha()).most_common()
    return sorted(cnts, key=lambda x: (-x[1], x[0]))

def letter_frequency(text):
  text = text.lower()
  return sorted([(e, text.count(e)) for e in set(text) if e.isalpha()], key = lambda e: (-e[1], e[0]))